diff --git a/src/Apis/v1_0.php b/src/Apis/v1_0.php index b8edf93..f9ba0ab 100644 --- a/src/Apis/v1_0.php +++ b/src/Apis/v1_0.php @@ -174,8 +174,17 @@ final class v1_0 implements \Uiharu\IApi { if($result->hasMediaType()) $resp->content_type = MediaTypeExts::toV1($result->getMediaType()); - if($result->hasColour()) - $resp->color = Colour::toHexString($result->getColour()); + if($result->hasColour()) { + $colour = $result->getColour(); + if($colour->getAlpha() < 1.0) + $colour = new ColourRGB( + $colour->getRed(), + $colour->getGreen(), + $colour->getBlue() + ); + + $resp->color = (string)$colour; + } if($result->hasTitle()) $resp->title = $result->getTitle(); if($result->hasSiteName()) diff --git a/src/Colour.php b/src/Colour.php deleted file mode 100644 index 0876b39..0000000 --- a/src/Colour.php +++ /dev/null @@ -1,469 +0,0 @@ -siteInfo->colour); } - public function getColour(): int { - return Colour::convertFromCSS($this->siteInfo->colour); + public function getColour(): Colour { + return Colour::parse($this->siteInfo->colour); } public function hasTitle(): bool { diff --git a/src/Lookup/YouTubeLookupResult.php b/src/Lookup/YouTubeLookupResult.php index cdae6e1..b1f67ab 100644 --- a/src/Lookup/YouTubeLookupResult.php +++ b/src/Lookup/YouTubeLookupResult.php @@ -4,6 +4,8 @@ namespace Uiharu\Lookup; use RuntimeException; use Uiharu\Url; use Index\MediaType; +use Index\Colour\Colour; +use Index\Colour\ColourRGB; final class YouTubeLookupResult implements \Uiharu\ILookupResult { public function __construct( @@ -61,8 +63,8 @@ final class YouTubeLookupResult implements \Uiharu\ILookupResult { public function hasColour(): bool { return true; } - public function getColour(): int { - return 0xFF0000; + public function getColour(): Colour { + return ColourRGB::fromRawRGB(0xFF0000); } public function hasTitle(): bool {