Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Intervention's ColorInterface as typehint #19

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/Interfaces/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

namespace SimonHamp\TheOg\Interfaces;

use Intervention\Image\Colors\Rgb\Color;
use Intervention\Image\Interfaces\ColorInterface;

interface Theme
{
public function accentColor(string $color): self;

public function getAccentColor(): Color;
public function getAccentColor(): ColorInterface;

public function background(Background $background): self;

public function getBackground(): ?Background;

public function backgroundColor(string $color): self;

public function getBackgroundColor(): Color;
public function getBackgroundColor(): ColorInterface;

public function backgroundOpacity(float $opacity): self;

Expand All @@ -28,47 +28,47 @@ public function getBackgroundUrl(): ?string;

public function baseColor(string $color): self;

public function getBaseColor(): Color;
public function getBaseColor(): ColorInterface;

public function baseFont(Font $font): self;

public function getBaseFont(): Font;

public function borderColor(string $color): self;

public function getBorderColor(): Color;
public function getBorderColor(): ColorInterface;

public function callToActionBackgroundColor(string $color): self;

public function getCallToActionBackgroundColor(): Color;
public function getCallToActionBackgroundColor(): ColorInterface;

public function callToActionColor(string $color): self;

public function getCallToActionColor(): Color;
public function getCallToActionColor(): ColorInterface;

public function callToActionFont(Font $font): self;

public function getCallToActionFont(): Font;

public function descriptionColor(string $color): self;

public function getDescriptionColor(): Color;
public function getDescriptionColor(): ColorInterface;

public function descriptionFont(Font $font): self;

public function getDescriptionFont(): Font;

public function titleColor(string $color): self;

public function getTitleColor(): Color;
public function getTitleColor(): ColorInterface;

public function titleFont(Font $font): self;

public function getTitleFont(): Font;

public function urlColor(string $color): self;

public function getUrlColor(): Color;
public function getUrlColor(): ColorInterface;

public function urlFont(Font $font): self;

Expand Down
19 changes: 10 additions & 9 deletions src/Theme/AbstractTheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace SimonHamp\TheOg\Theme;

use Intervention\Image\Colors\Rgb\Color;
use Intervention\Image\Interfaces\ColorInterface;
use SimonHamp\TheOg\Background as BuiltInBackground;
use SimonHamp\TheOg\Interfaces\Background;
use SimonHamp\TheOg\Interfaces\Font;
Expand Down Expand Up @@ -39,7 +40,7 @@ public function accentColor(string $color): self
return $this;
}

public function getAccentColor(): Color
public function getAccentColor(): ColorInterface
{
return Color::create($this->accentColor);
}
Expand Down Expand Up @@ -76,7 +77,7 @@ public function backgroundColor(string $color): self
return $this;
}

public function getBackgroundColor(): Color
public function getBackgroundColor(): ColorInterface
{
return Color::create($this->backgroundColor);
}
Expand All @@ -98,7 +99,7 @@ public function baseColor(string $color): self
return $this;
}

public function getBaseColor(): Color
public function getBaseColor(): ColorInterface
{
return Color::create($this->baseColor);
}
Expand All @@ -121,7 +122,7 @@ public function borderColor(string $color): self
return $this;
}

public function getBorderColor(): Color
public function getBorderColor(): ColorInterface
{
return Color::create($this->borderColor ?? $this->accentColor);
}
Expand All @@ -132,7 +133,7 @@ public function callToActionBackgroundColor(string $color): self
return $this;
}

public function getCallToActionBackgroundColor(): Color
public function getCallToActionBackgroundColor(): ColorInterface
{
return Color::create($this->callToActionBackgroundColor ?? $this->accentColor);
}
Expand All @@ -143,7 +144,7 @@ public function callToActionColor(string $color): self
return $this;
}

public function getCallToActionColor(): Color
public function getCallToActionColor(): ColorInterface
{
return Color::create($this->callToActionColor ?? $this->baseColor);
}
Expand All @@ -165,7 +166,7 @@ public function descriptionColor(string $color): self
return $this;
}

public function getDescriptionColor(): Color
public function getDescriptionColor(): ColorInterface
{
return Color::create($this->descriptionColor ?? $this->baseColor);
}
Expand All @@ -187,7 +188,7 @@ public function titleColor(string $color): self
return $this;
}

public function getTitleColor(): Color
public function getTitleColor(): ColorInterface
{
return Color::create($this->titleColor ?? $this->baseColor);
}
Expand All @@ -209,7 +210,7 @@ public function urlColor(string $color): self
return $this;
}

public function getUrlColor(): Color
public function getUrlColor(): ColorInterface
{
return Color::create($this->urlColor ?? $this->accentColor);
}
Expand Down