PHP Класс SassScriptFunctions

A collection of functions for use in SassSCript.
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$parser

Открытые методы

Метод Описание
_if ( SassBoolean $condition, mixed $if_true, mixed $if_false ) : mixed An inline "if-else" statement.
abs ( SassNumber $number ) : SassNumber Finds the absolute value of a number.
adjust ( SassColour $colour, SassNumber $amount, boolean $ofCurrent, string $att, boolean $op, float $min, float $max, string $units = '' ) : SassColour Adjusts the colour
adjust_color ( SassColour $color, integer $red, integer $green, integer $blue, integer $hue, integer $saturation, integer $lightness, integer $alpha ) : SassColour Adjusts one or more property of the color by the value requested.
adjust_hue ( SassColour $colour, SassNumber $degrees ) : SassColour Changes the hue of a colour while retaining the lightness and saturation.
alpha ( SassColour $colour ) : SassNumber Returns the alpha component (opacity) of a colour.
append ( $list, $val, $sep = ', ' )
blue ( SassColour $colour ) : SassNumber Returns the blue component of a colour.
ceil ( SassNumber $number ) : SassNumber Rounds a number up to the nearest whole number.
change_color ( SassColour $color, boolean $red = false, boolean $green = false, boolean $blue = false, boolean $hue = false, boolean $saturation = false, boolean $lightness = false, boolean $alpha = false ) : SassColour Changes one or more properties of the color to the requested value
comparable ( SassNumber $number1, SassNumber $number2 ) : SassBoolean Returns true if two numbers are similar enough to be added, subtracted, or compared.
complement ( SassColour $colour ) : SassColour Returns the complement of a colour.
darken ( SassColour $colour, SassNumber $amount, SassBoolean $ofCurrent = false ) : SassColour Makes a colour darker.
desaturate ( SassColour $colour, SassNumber $amount, SassBoolean $ofCurrent = false ) : SassColour Makes a colour less saturated.
fade_in ( SassColour $colour, SassNumber $amount, SassBoolean $ofCurrent = false ) : SassColour Makes a colour more opaque.
fade_out ( SassColour $colour, SassNumber $amount, SassBoolean $ofCurrent = false ) : SassColour Makes a colour more transparent.
floor ( SassNumber $number ) : SassNumber Rounds down to the nearest whole number.
get_var ( $string ) : SassString Returns the variable whose name is the string.
grayscale ( SassColour $colour ) : SassColour Greyscale for non-english speakers.
green ( SassColour $colour ) : SassNumber Returns the green component of a colour.
greyscale ( SassColour $colour ) : SassColour Converts a colour to greyscale.
hsl ( float $h, mixed $s, mixed $l ) : SassColour Creates a SassColour object from hue, saturation, and lightness.
hsla ( SassNumber $h, SassNumber $s, SassNumber $l, float $a ) : SassColour Creates a SassColour object from hue, saturation, lightness and alpha channel (opacity).
hue ( SassColour $colour ) : SassNumber Returns the hue component of a colour.
ie_hex_str ( $color ) returns an IE hex string for a color with an alpha channel suitable for passing to IE filters.
inRange ( float $value, float $min, float $max ) : mixed Ensures the value is within the given range, clipping it if needed.
index ( $list, $value )
invert ( SassColour $colour ) : SassColour: Inverts a colour.
join ( $one, $two, $sep = ', ' )
length ( $list ) : SassNumber Returns the length of the $list
lighten ( SassColour $colour, SassNumber $amount, SassBoolean $ofCurrent = false ) : SassColour Makes a colour lighter.
lightness ( SassColour $colour ) : SassNumber Returns the lightness component of a colour.
max ( )
min ( )
mix ( SassColour $colour1, SassColour $colour2, float $weight = '50%' ) : SassColour Mixes two colours together.
nth ( $list, $n ) : mixed Returns the nth value ofthe $list
opacify ( SassColour $colour, SassNumber $amount, $ofCurrent = false ) : SassColour Makes a colour more opaque.
opacity ( SassColour $colour ) : SassNumber Returns the alpha component (opacity) of a colour.
option ( $name )
percentage ( SassNumber $number ) : SassNumber Converts a decimal number to a percentage.
quote ( string $string ) : SassString Add quotes to a string if the string isn't quoted, or returns the same string if it is.
red ( SassColour $colour ) : SassNumber Returns the red component of a colour.
rgb ( SassNumber $red, SassNumber $green, SassNumber $blue ) : SassColour Creates a SassColour object from red, green, and blue values.
rgba ( ) : SassColour Creates a SassColour object from red, green, and blue values and alpha channel (opacity).
round ( SassNumber $number ) : SassNumber Rounds a number to the nearest whole number.
saturate ( SassColour $colour, SassNumber $amount, $ofCurrent = false ) : SassColour Makes a colour more saturated.
saturation ( SassColour $colour ) : SassNumber Returns the saturation component of a colour.
scale_color ( SassColour $color, integer $red, integer $green, integer $blue, integer $saturation, integer $lightness, integer $alpha ) : SassColour Scales one or more property of the color by the percentage requested.
shade ( SassColour $colour, SassNumber $amount ) : SassColour Changes the shade of a colour, mixing it with the $amount of black.
tint ( SassColour $colour, SassNumber $amount ) : SassColour Changes the tint of a colour, mixing it with the $amount of white.
transparentize ( SassColour $colour, SassNumber $amount, $ofCurrent = false ) : SassColour Makes a colour more transparent.
type_of ( SassLiteral $obj ) : SassString Inspects the type of the argument, returning it as an unquoted string.
unit ( SassNumber $number ) : SassString Inspects the unit of the number, returning it as a quoted string.
unitless ( SassNumber $number ) : SassBoolean Inspects the unit of the number, returning a boolean indicating if it is unitless.
units ( SassNumber $number ) : SassString Inspects the units of the number, returning it as a quoted string.
unquote ( string $string ) : SassString Removes quotes from a string if the string is quoted, or returns the same string if it's not.
zip ( ) New function zip allows several lists to be combined into one list of lists. For example: zip(1px 1px 3px, solid dashed solid, red green blue) becomes 1px solid red, 1px dashed green, 3px solid blue

Описание методов

_if() публичный статический Метод

An inline "if-else" statement.
public static _if ( SassBoolean $condition, mixed $if_true, mixed $if_false ) : mixed
$condition SassBoolean - values are loosely-evaulated by PHP, so 'false' includes null, false, 0, ''
$if_true mixed returns if Condition is true
$if_false mixed returns if Condition is false
Результат mixed

abs() публичный статический Метод

For example: abs(10px) => 10px abs(-10px) => 10px
public static abs ( SassNumber $number ) : SassNumber
$number SassNumber number to round
Результат SassNumber The absolute value of the number

adjust() публичный статический Метод

Adjusts the colour
public static adjust ( SassColour $colour, SassNumber $amount, boolean $ofCurrent, string $att, boolean $op, float $min, float $max, string $units = '' ) : SassColour
$colour SassColour the colour to adjust
$amount SassNumber the amount to adust by
$ofCurrent boolean whether the amount is a proportion of the current value or the total range
$att string the attribute to adjust
$op boolean whether to decrease (false) or increase (true) the value of the attribute
$min float minimum value the amount can be
$max float maximum value the amount can bemixed
$units string amount units
Результат SassColour

adjust_color() публичный статический Метод

Adjusts one or more property of the color by the value requested.
public static adjust_color ( SassColour $color, integer $red, integer $green, integer $blue, integer $hue, integer $saturation, integer $lightness, integer $alpha ) : SassColour
$color SassColour the colour to adjust
$red integer
$green integer
$blue integer
$hue integer
$saturation integer
$lightness integer
$alpha integer
Результат SassColour

adjust_hue() публичный статический Метод

Changes the hue of a colour while retaining the lightness and saturation.
public static adjust_hue ( SassColour $colour, SassNumber $degrees ) : SassColour
$colour SassColour The colour to adjust
$degrees SassNumber The amount to adjust the colour by
Результат SassColour The adjusted colour

alpha() публичный статический Метод

Returns the alpha component (opacity) of a colour.
public static alpha ( SassColour $colour ) : SassNumber
$colour SassColour The colour
Результат SassNumber The alpha component (opacity) of colour

append() публичный статический Метод

public static append ( $list, $val, $sep = ', ' )

blue() публичный статический Метод

Returns the blue component of a colour.
public static blue ( SassColour $colour ) : SassNumber
$colour SassColour The colour
Результат SassNumber The blue component of colour

ceil() публичный статический Метод

For example: ceil(10.4px) => 11px ceil(10.6px) => 11px
public static ceil ( SassNumber $number ) : SassNumber
$number SassNumber The number to round
Результат SassNumber The rounded number

change_color() публичный статический Метод

Changes one or more properties of the color to the requested value
public static change_color ( SassColour $color, boolean $red = false, boolean $green = false, boolean $blue = false, boolean $hue = false, boolean $saturation = false, boolean $lightness = false, boolean $alpha = false ) : SassColour
$color SassColour the color to change
$red boolean
$green boolean
$blue boolean
$hue boolean
$saturation boolean
$lightness boolean
$alpha boolean
Результат SassColour

comparable() публичный статический Метод

Returns true if two numbers are similar enough to be added, subtracted, or compared.
public static comparable ( SassNumber $number1, SassNumber $number2 ) : SassBoolean
$number1 SassNumber The first number to test
$number2 SassNumber The second number to test
Результат SassBoolean True if the numbers are similar

complement() публичный статический Метод

Rotates the hue by 180 degrees.
public static complement ( SassColour $colour ) : SassColour
$colour SassColour The colour
Результат SassColour The comlemented colour

darken() публичный статический Метод

Makes a colour darker.
См. также: adjust
public static darken ( SassColour $colour, SassNumber $amount, SassBoolean $ofCurrent = false ) : SassColour
$colour SassColour The colour to darken
$amount SassNumber The amount to darken the colour by
$ofCurrent SassBoolean Whether the amount is a proportion of the current value (true) or the total range (false). The default is false - the amount is a proportion of the total range. If the colour lightness value is 80% and the amount is 50%, the resulting colour lightness value is 30% if the amount is a proportion of the total range, whereas it is 40% if the amount is a proportion of the current value.
Результат SassColour The darkened colour

desaturate() публичный статический Метод

Makes a colour less saturated.
См. также: adjust
public static desaturate ( SassColour $colour, SassNumber $amount, SassBoolean $ofCurrent = false ) : SassColour
$colour SassColour The colour to desaturate
$amount SassNumber The amount to desaturate the colour by
$ofCurrent SassBoolean Whether the amount is a proportion of the current value (true) or the total range (false). The default is false - the amount is a proportion of the total range. If the colour saturation value is 80% and the amount is 50%, the resulting colour saturation value is 30% if the amount is a proportion of the total range, whereas it is 40% if the amount is a proportion of the current value.
Результат SassColour The desaturateed colour

fade_in() публичный статический Метод

Alias for {@link opacify}.
См. также: opacify
public static fade_in ( SassColour $colour, SassNumber $amount, SassBoolean $ofCurrent = false ) : SassColour
$colour SassColour The colour to opacify
$amount SassNumber The amount to opacify the colour by
$ofCurrent SassBoolean Whether the amount is a proportion of the current value (true) or the total range (false).
Результат SassColour The opacified colour

fade_out() публичный статический Метод

Alias for {@link transparentize}.
См. также: transparentize
public static fade_out ( SassColour $colour, SassNumber $amount, SassBoolean $ofCurrent = false ) : SassColour
$colour SassColour The colour to transparentize
$amount SassNumber The amount to transparentize the colour by
$ofCurrent SassBoolean Whether the amount is a proportion of the current value (true) or the total range (false).
Результат SassColour The transparentized colour

floor() публичный статический Метод

For example: floor(10.4px) => 10px floor(10.6px) => 10px
public static floor ( SassNumber $number ) : SassNumber
$number SassNumber The number to round
Результат SassNumber The rounded number

get_var() публичный статический Метод

Returns the variable whose name is the string.
public static get_var ( $string ) : SassString
Результат SassString

grayscale() публичный статический Метод

Greyscale for non-english speakers.
См. также: desaturate
public static grayscale ( SassColour $colour ) : SassColour
$colour SassColour The colour
Результат SassColour The greyscale colour

green() публичный статический Метод

Returns the green component of a colour.
public static green ( SassColour $colour ) : SassNumber
$colour SassColour The colour
Результат SassNumber The green component of colour

greyscale() публичный статический Метод

Reduces the saturation to zero.
См. также: desaturate
public static greyscale ( SassColour $colour ) : SassColour
$colour SassColour The colour
Результат SassColour The greyscale colour

hsl() публичный статический Метод

Uses the algorithm from the {@link http://www.w3.org/TR/css3-colour/#hsl-colour CSS3 spec}.
public static hsl ( float $h, mixed $s, mixed $l ) : SassColour
$h float The hue of the colour in degrees. Should be between 0 and 360 inclusive
$s mixed The saturation of the colour as a percentage. Must be between '0%' and 100%, inclusive
$l mixed The lightness of the colour as a percentage. Must be between 0% and 100%, inclusive
Результат SassColour The resulting colour

hsla() публичный статический Метод

Creates a SassColour object from hue, saturation, lightness and alpha channel (opacity).
public static hsla ( SassNumber $h, SassNumber $s, SassNumber $l, float $a ) : SassColour
$h SassNumber The hue of the colour in degrees. Should be between 0 and 360 inclusive
$s SassNumber The saturation of the colour as a percentage. Must be between 0% and 100% inclusive
$l SassNumber The lightness of the colour as a percentage. Must be between 0% and 100% inclusive
$a float The alpha channel. A number between 0 and 1.
Результат SassColour The resulting colour

hue() публичный статический Метод

Returns the hue component of a colour.
public static hue ( SassColour $colour ) : SassNumber
$colour SassColour The colour
Результат SassNumber The hue component of colour

ie_hex_str() публичный статический Метод

returns an IE hex string for a color with an alpha channel suitable for passing to IE filters.
public static ie_hex_str ( $color )

inRange() публичный статический Метод

Ensures the value is within the given range, clipping it if needed.
public static inRange ( float $value, float $min, float $max ) : mixed
$value float the value to test
$min float the minimum value
$max float the maximum value
Результат mixed the value clipped to the range

index() публичный статический Метод

public static index ( $list, $value )

invert() публичный статический Метод

The red, green, and blue values are inverted value = (255 - value)
public static invert ( SassColour $colour ) : SassColour:
$colour SassColour the colour
Результат SassColour:

join() публичный статический Метод

public static join ( $one, $two, $sep = ', ' )

length() публичный статический Метод

Returns the length of the $list
public static length ( $list ) : SassNumber
Результат SassNumber

lighten() публичный статический Метод

Makes a colour lighter.
См. также: lighten_rel
public static lighten ( SassColour $colour, SassNumber $amount, SassBoolean $ofCurrent = false ) : SassColour
$colour SassColour The colour to lighten
$amount SassNumber The amount to lighten the colour by
$ofCurrent SassBoolean Whether the amount is a proportion of the current value (true) or the total range (false). The default is false - the amount is a proportion of the total range. If the colour lightness value is 40% and the amount is 50%, the resulting colour lightness value is 90% if the amount is a proportion of the total range, whereas it is 60% if the amount is a proportion of the current value.
Результат SassColour The lightened colour

lightness() публичный статический Метод

Returns the lightness component of a colour.
public static lightness ( SassColour $colour ) : SassNumber
$colour SassColour The colour
Результат SassNumber The lightness component of colour

max() публичный статический Метод

public static max ( )

min() публичный статический Метод

public static min ( )

mix() публичный статический Метод

Takes the average of each of the RGB components, optionally weighted by the given percentage. The opacity of the colours is also considered when weighting the components. The weight specifies the amount of the first colour that should be included in the returned colour. The default, 50%, means that half the first colour and half the second colour should be used. 25% means that a quarter of the first colour and three quarters of the second colour should be used. For example: mix(#f00, #00f) => #7f007f mix(#f00, #00f, 25%) => #3f00bf mix(rgba(255, 0, 0, 0.5), #00f) => rgba(63, 0, 191, 0.75)
public static mix ( SassColour $colour1, SassColour $colour2, float $weight = '50%' ) : SassColour
$colour1 SassColour The first colour
$colour2 SassColour The second colour
$weight float Percentage of the first colour to use
Результат SassColour The mixed colour

nth() публичный статический Метод

Returns the nth value ofthe $list
public static nth ( $list, $n ) : mixed
Результат mixed

opacify() публичный статический Метод

Makes a colour more opaque.
См. также: opacify_rel
public static opacify ( SassColour $colour, SassNumber $amount, $ofCurrent = false ) : SassColour
$colour SassColour The colour to opacify
$amount SassNumber The amount to opacify the colour by If this is a unitless number between 0 and 1 the adjustment is absolute, if it is a percentage the adjustment is relative. If the colour alpha value is 0.4 if the amount is 0.5 the resulting colour alpha value is 0.9, whereas if the amount is 50% the resulting colour alpha value is 0.6.
Результат SassColour The opacified colour

opacity() публичный статический Метод

Returns the alpha component (opacity) of a colour.
public static opacity ( SassColour $colour ) : SassNumber
$colour SassColour The colour
Результат SassNumber The alpha component (opacity) of colour

option() публичный статический Метод

public static option ( $name )

percentage() публичный статический Метод

For example: percentage(100px / 50px) => 200%
public static percentage ( SassNumber $number ) : SassNumber
$number SassNumber The decimal number to convert to a percentage
Результат SassNumber The number as a percentage

quote() публичный статический Метод

Add quotes to a string if the string isn't quoted, or returns the same string if it is.
См. также: unquote
public static quote ( string $string ) : SassString
$string string String to quote
Результат SassString Quoted string

red() публичный статический Метод

Returns the red component of a colour.
public static red ( SassColour $colour ) : SassNumber
$colour SassColour The colour
Результат SassNumber The red component of colour

rgb() публичный статический Метод

Creates a SassColour object from red, green, and blue values.
public static rgb ( SassNumber $red, SassNumber $green, SassNumber $blue ) : SassColour
$red SassNumber the red component. A number between 0 and 255 inclusive, or between 0% and 100% inclusive
$green SassNumber the green component. A number between 0 and 255 inclusive, or between 0% and 100% inclusive
$blue SassNumber the blue component. A number between 0 and 255 inclusive, or between 0% and 100% inclusive
Результат SassColour new SassColour SassColour object

rgba() публичный статический Метод

There are two overloads: * rgba(red, green, blue, alpha)
public static rgba ( ) : SassColour
Результат SassColour new SassColour SassColour object

round() публичный статический Метод

For example: round(10.4px) => 10px round(10.6px) => 11px
public static round ( SassNumber $number ) : SassNumber
$number SassNumber The number to round
Результат SassNumber The rounded number

saturate() публичный статический Метод

Makes a colour more saturated.
См. также: adjust
public static saturate ( SassColour $colour, SassNumber $amount, $ofCurrent = false ) : SassColour
$colour SassColour The colour to saturate
$amount SassNumber The amount to saturate the colour by
Результат SassColour The saturated colour

saturation() публичный статический Метод

Returns the saturation component of a colour.
public static saturation ( SassColour $colour ) : SassNumber
$colour SassColour The colour
Результат SassNumber The saturation component of colour

scale_color() публичный статический Метод

Scales one or more property of the color by the percentage requested.
public static scale_color ( SassColour $color, integer $red, integer $green, integer $blue, integer $saturation, integer $lightness, integer $alpha ) : SassColour
$color SassColour the colour to adjust
$red integer
$green integer
$blue integer
$saturation integer
$lightness integer
$alpha integer
Результат SassColour

shade() публичный статический Метод

Changes the shade of a colour, mixing it with the $amount of black.
public static shade ( SassColour $colour, SassNumber $amount ) : SassColour
$colour SassColour The colour to adjust
$amount SassNumber The amount of black to mix with the $colour
Результат SassColour The adjusted colour

tint() публичный статический Метод

Changes the tint of a colour, mixing it with the $amount of white.
public static tint ( SassColour $colour, SassNumber $amount ) : SassColour
$colour SassColour The colour to adjust
$amount SassNumber The amount of white to mix with the $colour
Результат SassColour The adjusted colour

transparentize() публичный статический Метод

Makes a colour more transparent.
public static transparentize ( SassColour $colour, SassNumber $amount, $ofCurrent = false ) : SassColour
$colour SassColour The colour to transparentize
$amount SassNumber The amount to transparentize the colour by. If this is a unitless number between 0 and 1 the adjustment is absolute, if it is a percentage the adjustment is relative. If the colour alpha value is 0.8 if the amount is 0.5 the resulting colour alpha value is 0.3, whereas if the amount is 50% the resulting colour alpha value is 0.4.
Результат SassColour The transparentized colour

type_of() публичный статический Метод

Inspects the type of the argument, returning it as an unquoted string.
public static type_of ( SassLiteral $obj ) : SassString
$obj SassLiteral The object to inspect
Результат SassString The type of object

unit() публичный статический Метод

Alias for units.
См. также: units
public static unit ( SassNumber $number ) : SassString
$number SassNumber The number to inspect
Результат SassString The units of the number

unitless() публичный статический Метод

Inspects the unit of the number, returning a boolean indicating if it is unitless.
public static unitless ( SassNumber $number ) : SassBoolean
$number SassNumber The number to inspect
Результат SassBoolean True if the number is unitless, false if it has units.

units() публичный статический Метод

Inspects the units of the number, returning it as a quoted string.
public static units ( SassNumber $number ) : SassString
$number SassNumber The number to inspect
Результат SassString The units of the number

unquote() публичный статический Метод

Removes quotes from a string if the string is quoted, or returns the same string if it's not.
См. также: quote
public static unquote ( string $string ) : SassString
$string string String to unquote
Результат SassString Unuoted string

zip() публичный Метод

New function zip allows several lists to be combined into one list of lists. For example: zip(1px 1px 3px, solid dashed solid, red green blue) becomes 1px solid red, 1px dashed green, 3px solid blue
public zip ( )

Описание свойств

$parser публичное статическое свойство

public static $parser