PHP Class SassScriptFunctions

A collection of functions for use in SassSCript.
Afficher le fichier Open project: richthegeek/phpsass

Méthodes publiques

Свойство Type Description
$parser

Méthodes publiques

Méthode Description
_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

Method Details

_if() public static méthode

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
Résultat mixed

abs() public static méthode

For example: abs(10px) => 10px abs(-10px) => 10px
public static abs ( SassNumber $number ) : SassNumber
$number SassNumber number to round
Résultat SassNumber The absolute value of the number

adjust() public static méthode

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
Résultat SassColour

adjust_color() public static méthode

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
Résultat SassColour

adjust_hue() public static méthode

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
Résultat SassColour The adjusted colour

alpha() public static méthode

Returns the alpha component (opacity) of a colour.
public static alpha ( SassColour $colour ) : SassNumber
$colour SassColour The colour
Résultat SassNumber The alpha component (opacity) of colour

append() public static méthode

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

blue() public static méthode

Returns the blue component of a colour.
public static blue ( SassColour $colour ) : SassNumber
$colour SassColour The colour
Résultat SassNumber The blue component of colour

ceil() public static méthode

For example: ceil(10.4px) => 11px ceil(10.6px) => 11px
public static ceil ( SassNumber $number ) : SassNumber
$number SassNumber The number to round
Résultat SassNumber The rounded number

change_color() public static méthode

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
Résultat SassColour

comparable() public static méthode

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
Résultat SassBoolean True if the numbers are similar

complement() public static méthode

Rotates the hue by 180 degrees.
public static complement ( SassColour $colour ) : SassColour
$colour SassColour The colour
Résultat SassColour The comlemented colour

darken() public static méthode

Makes a colour darker.
See also: 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.
Résultat SassColour The darkened colour

desaturate() public static méthode

Makes a colour less saturated.
See also: 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.
Résultat SassColour The desaturateed colour

fade_in() public static méthode

Alias for {@link opacify}.
See also: 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).
Résultat SassColour The opacified colour

fade_out() public static méthode

Alias for {@link transparentize}.
See also: 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).
Résultat SassColour The transparentized colour

floor() public static méthode

For example: floor(10.4px) => 10px floor(10.6px) => 10px
public static floor ( SassNumber $number ) : SassNumber
$number SassNumber The number to round
Résultat SassNumber The rounded number

get_var() public static méthode

Returns the variable whose name is the string.
public static get_var ( $string ) : SassString
Résultat SassString

grayscale() public static méthode

Greyscale for non-english speakers.
See also: desaturate
public static grayscale ( SassColour $colour ) : SassColour
$colour SassColour The colour
Résultat SassColour The greyscale colour

green() public static méthode

Returns the green component of a colour.
public static green ( SassColour $colour ) : SassNumber
$colour SassColour The colour
Résultat SassNumber The green component of colour

greyscale() public static méthode

Reduces the saturation to zero.
See also: desaturate
public static greyscale ( SassColour $colour ) : SassColour
$colour SassColour The colour
Résultat SassColour The greyscale colour

hsl() public static méthode

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
Résultat SassColour The resulting colour

hsla() public static méthode

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.
Résultat SassColour The resulting colour

hue() public static méthode

Returns the hue component of a colour.
public static hue ( SassColour $colour ) : SassNumber
$colour SassColour The colour
Résultat SassNumber The hue component of colour

ie_hex_str() public static méthode

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() public static méthode

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
Résultat mixed the value clipped to the range

index() public static méthode

public static index ( $list, $value )

invert() public static méthode

The red, green, and blue values are inverted value = (255 - value)
public static invert ( SassColour $colour ) : SassColour:
$colour SassColour the colour
Résultat SassColour:

join() public static méthode

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

length() public static méthode

Returns the length of the $list
public static length ( $list ) : SassNumber
Résultat SassNumber

lighten() public static méthode

Makes a colour lighter.
See also: 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.
Résultat SassColour The lightened colour

lightness() public static méthode

Returns the lightness component of a colour.
public static lightness ( SassColour $colour ) : SassNumber
$colour SassColour The colour
Résultat SassNumber The lightness component of colour

max() public static méthode

public static max ( )

min() public static méthode

public static min ( )

mix() public static méthode

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
Résultat SassColour The mixed colour

nth() public static méthode

Returns the nth value ofthe $list
public static nth ( $list, $n ) : mixed
Résultat mixed

opacify() public static méthode

Makes a colour more opaque.
See also: 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.
Résultat SassColour The opacified colour

opacity() public static méthode

Returns the alpha component (opacity) of a colour.
public static opacity ( SassColour $colour ) : SassNumber
$colour SassColour The colour
Résultat SassNumber The alpha component (opacity) of colour

option() public static méthode

public static option ( $name )

percentage() public static méthode

For example: percentage(100px / 50px) => 200%
public static percentage ( SassNumber $number ) : SassNumber
$number SassNumber The decimal number to convert to a percentage
Résultat SassNumber The number as a percentage

quote() public static méthode

Add quotes to a string if the string isn't quoted, or returns the same string if it is.
See also: unquote
public static quote ( string $string ) : SassString
$string string String to quote
Résultat SassString Quoted string

red() public static méthode

Returns the red component of a colour.
public static red ( SassColour $colour ) : SassNumber
$colour SassColour The colour
Résultat SassNumber The red component of colour

rgb() public static méthode

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
Résultat SassColour new SassColour SassColour object

rgba() public static méthode

There are two overloads: * rgba(red, green, blue, alpha)
public static rgba ( ) : SassColour
Résultat SassColour new SassColour SassColour object

round() public static méthode

For example: round(10.4px) => 10px round(10.6px) => 11px
public static round ( SassNumber $number ) : SassNumber
$number SassNumber The number to round
Résultat SassNumber The rounded number

saturate() public static méthode

Makes a colour more saturated.
See also: 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
Résultat SassColour The saturated colour

saturation() public static méthode

Returns the saturation component of a colour.
public static saturation ( SassColour $colour ) : SassNumber
$colour SassColour The colour
Résultat SassNumber The saturation component of colour

scale_color() public static méthode

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
Résultat SassColour

shade() public static méthode

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
Résultat SassColour The adjusted colour

tint() public static méthode

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
Résultat SassColour The adjusted colour

transparentize() public static méthode

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.
Résultat SassColour The transparentized colour

type_of() public static méthode

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
Résultat SassString The type of object

unit() public static méthode

Alias for units.
See also: units
public static unit ( SassNumber $number ) : SassString
$number SassNumber The number to inspect
Résultat SassString The units of the number

unitless() public static méthode

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
Résultat SassBoolean True if the number is unitless, false if it has units.

units() public static méthode

Inspects the units of the number, returning it as a quoted string.
public static units ( SassNumber $number ) : SassString
$number SassNumber The number to inspect
Résultat SassString The units of the number

unquote() public static méthode

Removes quotes from a string if the string is quoted, or returns the same string if it's not.
See also: quote
public static unquote ( string $string ) : SassString
$string string String to unquote
Résultat SassString Unuoted string

zip() public méthode

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 ( )

Property Details

$parser public_oe static_oe property

public static $parser