Skip to content

Commit c17523d

Browse files
author
ju1ius
committed
renamed ColorUtils to CSSColorUtils, fixed typo in test .css file
1 parent 1c6e56b commit c17523d

File tree

6 files changed

+16
-525
lines changed

6 files changed

+16
-525
lines changed

CSSParser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
require_once('lib/CSSCharsetUtils.php');
33
require_once('lib/CSSUrlUtils.php');
4-
require_once 'lib/ColorUtils.php';
4+
require_once 'lib/CSSColorUtils.php';
55
require_once('lib/CSSProperties.php');
66
require_once('lib/CSSList.php');
77
require_once('lib/CSSRuleSet.php');
@@ -390,7 +390,7 @@ private function parseIdentifier($bAllowFunctions = false, $bAllowColors = false
390390
if($bAllowColors)
391391
{
392392
// is it a color name ?
393-
if($aColor = ColorUtils::namedColor2rgb($sResult))
393+
if($aColor = CSSColorUtils::namedColor2rgb($sResult))
394394
{
395395
$oColor = new CSSColor();
396396
return $oColor->fromRGB($aColor);

lib/CSSValueList.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ public function __construct($mColor=null) {
8383
}
8484
}
8585
else if(is_string($mColor)) {
86-
if($aRGB = ColorUtils::namedColor2rgb($mColor)) {
86+
if($aRGB = CSSColorUtils::namedColor2rgb($mColor)) {
8787
$this->fromRGB($aRGB);
8888
}
89-
else if($aRGB = ColorUtils::hex2rgb($mColor)) {
89+
else if($aRGB = CSSColorUtils::hex2rgb($mColor)) {
9090
$this->fromRGB($aRGB);
9191
}
9292
}
@@ -98,12 +98,12 @@ public function fromRGB(Array $aRGB) {
9898
foreach(array('r', 'g', 'b', 'a') as $sChannel) {
9999
if($sChannel == 'a') {
100100
if(!isset($aRGB['a'])) continue;
101-
$sValue = ColorUtils::constrainValue((string)$aRGB['a'], 0, 1);
101+
$sValue = CSSColorUtils::constrainValue((string)$aRGB['a'], 0, 1);
102102
if($sValue == 1) continue;
103103
$sName .= 'a';
104104
}
105105
else {
106-
$sValue = ColorUtils::normalizeRGBValue((string)$aRGB[$sChannel]);
106+
$sValue = CSSColorUtils::normalizeRGBValue((string)$aRGB[$sChannel]);
107107
}
108108
$this->aComponents[$sChannel] = new CSSSize($sValue, null, true);
109109
}
@@ -112,7 +112,7 @@ public function fromRGB(Array $aRGB) {
112112
}
113113

114114
public function fromHSL(Array $aHSL) {
115-
$aRGB = ColorUtils::hsl2rgb(
115+
$aRGB = CSSColorUtils::hsl2rgb(
116116
(string)$aHSL['h'],
117117
(string)$aHSL['s'],
118118
(string)$aHSL['l'],
@@ -122,12 +122,12 @@ public function fromHSL(Array $aHSL) {
122122
}
123123

124124
public function fromHex($sValue) {
125-
$aRGB = ColorUtils::hex2rgb($sValue);
125+
$aRGB = CSSColorUtils::hex2rgb($sValue);
126126
return $this->fromRGB($aRGB);
127127
}
128128

129129
public function fromNamedColor($sValue) {
130-
$aRGB = ColorUtils::namedColor2rgb($sValue);
130+
$aRGB = CSSColorUtils::namedColor2rgb($sValue);
131131
return $this->fromRGB($aRGB);
132132
}
133133

@@ -157,7 +157,7 @@ public function toRGB() {
157157
}
158158
return;
159159
}
160-
$aRGB = ColorUtils::hsl2rgb(
160+
$aRGB = CSSColorUtils::hsl2rgb(
161161
$aComponents['h']->getSize(),
162162
$aComponents['s']->getSize(),
163163
$aComponents['l']->getSize(),
@@ -185,7 +185,7 @@ public function toHSL() {
185185
}
186186
return;
187187
}
188-
$aHSL = ColorUtils::rgb2hsl(
188+
$aHSL = CSSColorUtils::rgb2hsl(
189189
$aComponents['r']->getSize(),
190190
$aComponents['g']->getSize(),
191191
$aComponents['b']->getSize(),
@@ -207,7 +207,7 @@ public function toHSL() {
207207
public function getNamedColor() {
208208
$this->toRGB();
209209
$aComponents = $this->aComponents;
210-
return ColorUtils::rgb2NamedColor(
210+
return CSSColorUtils::rgb2NamedColor(
211211
$aComponents['r']->getSize(),
212212
$aComponents['g']->getSize(),
213213
$aComponents['b']->getSize()
@@ -219,14 +219,14 @@ public function getHexValue() {
219219
if(isset($aComponents['a']) && $aComponents['a']->getSize() !== 1) return null;
220220
$sName = $this->getName();
221221
if($sName == 'rgb') {
222-
return ColorUtils::rgb2hex(
222+
return CSSColorUtils::rgb2hex(
223223
$aComponents['r']->getSize(),
224224
$aComponents['g']->getSize(),
225225
$aComponents['b']->getSize()
226226
);
227227
}
228228
else if($sName == 'hsl') {
229-
return ColorUtils::hsl2hex(
229+
return CSSColorUtils::hsl2hex(
230230
$aComponents['h']->getSize(),
231231
$aComponents['s']->getSize(),
232232
$aComponents['l']->getSize()

0 commit comments

Comments
 (0)