PHP 클래스 ariColor, kirki

파일 보기 프로젝트 열기: aristath/kirki 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$alpha integer | float
$blue integer | double
$brightness array
$chroma integer | float
$color string | array The color as defined in the input
$green integer | double
$hex string The HEX value of the color.
$hue integer | float
$instances array Each instance is stored as an object in this array. Allows easier access & performance.
$lightness integer | float
$luminance integer | float
$mode string The mode of this color (hex/rgb/rgba etc.).
$red integer | double
$saturation integer | float
$word_colors array Example: white = #ffffff

공개 메소드들

메소드 설명
getNew ( $property = '', $value = '' ) : ariColor | null Allows us to get a new instance by modifying a property of the existing one.
get_mode ( string $color ) : string | null Figure out what mode we're using.
newColor ( $color, $mode = 'auto' ) : ariColor Gets an instance for this color.
toCSS ( $mode = 'hex' ) : string Returns a CSS-formatted value for colors.

비공개 메소드들

메소드 설명
__construct ( $color = '', $mode = 'auto' ) The class constructor
dexhex_double_digit ( $value ) : string Convert a decimal value to hex and make sure it's 2 characters
from_hex ( ) : void Starts with a HEX color and calculates all other properties.
from_hsl ( ) : void Starts with an HSL color and calculates all other properties.
from_hsl_array ( ) Calculates the red, green, blue values of an HSL color
from_hsla ( ) : void Starts with an HSLA color and calculates all other properties.
from_rgb ( ) : void Starts with an RGB color and calculates all other properties.
from_rgba ( ) : void Starts with an RGBA color and calculates all other properties.
get_word_colors ( ) : array Gets an array of all the wordcolors
rgb_to_hex ( $red, $green, $blue ) : string Generates the HEX value of a color given values for $red, $green, $blue
set_brightness ( ) Sets the brightness of a color based on the values of red, green, blue
set_hsl ( ) Sets the HSL values of a color based on the values of red, green, blue
set_luminance ( ) Sets the luminance of a color (range:0-255) based on the values of red, green, blue

메소드 상세

getNew() 공개 메소드

Allows us to get a new instance by modifying a property of the existing one.
public getNew ( $property = '', $value = '' ) : ariColor | null
$property string can be one of the following: red, green, blue, alpha, hue, saturation, lightness, brightness
$value int|float|string the new value
리턴 ariColor | null

get_mode() 공개 메소드

Figure out what mode we're using.
public get_mode ( string $color ) : string | null
$color string
리턴 string | null

newColor() 공개 정적인 메소드

We use a separate instance per color because there's no need to create a completely new instance each time we call this class. Instead using instances helps us improve performance & footprint.
public static newColor ( $color, $mode = 'auto' ) : ariColor
$color string|array
$mode string
리턴 ariColor (object)

toCSS() 공개 메소드

Returns a CSS-formatted value for colors.
public toCSS ( $mode = 'hex' ) : string
$mode string
리턴 string

프로퍼티 상세

$alpha 공개적으로 프로퍼티

public int|float $alpha
리턴 integer | float

$blue 공개적으로 프로퍼티

public int|double $blue
리턴 integer | double

$brightness 공개적으로 프로퍼티

public array $brightness
리턴 array

$chroma 공개적으로 프로퍼티

public int|float $chroma
리턴 integer | float

$color 공개적으로 프로퍼티

The color as defined in the input
public string|array $color
리턴 string | array

$green 공개적으로 프로퍼티

public int|double $green
리턴 integer | double

$hex 공개적으로 프로퍼티

The HEX value of the color.
public string $hex
리턴 string

$hue 공개적으로 프로퍼티

public int|float $hue
리턴 integer | float

$instances 공개적으로 정적으로 프로퍼티

Each instance is stored as an object in this array. Allows easier access & performance.
public static array $instances
리턴 array

$lightness 공개적으로 프로퍼티

public int|float $lightness
리턴 integer | float

$luminance 공개적으로 프로퍼티

public int|float $luminance
리턴 integer | float

$mode 공개적으로 프로퍼티

The mode of this color (hex/rgb/rgba etc.).
public string $mode
리턴 string

$red 공개적으로 프로퍼티

public int|double $red
리턴 integer | double

$saturation 공개적으로 프로퍼티

public int|float $saturation
리턴 integer | float

$word_colors 공개적으로 프로퍼티

Example: white = #ffffff
public array $word_colors
리턴 array