Module: layout/JCSSRule

Manipulate CSS stylesheet

Source:
layout/jCSSRule.js

Methods


<inner> darkenColor(color, inc)

Get a darker color

Parameters:
Name Type Description
color string

color string formated as #ffffff

inc number

increment, default -5

Source:
layout/jCSSRule.js

<inner> jCSSRule(selector, property, value)

Manipulate CSS styleSheet. The function will add a new property for the selector in a style sheet. The style sheet will be inserted where the js is placed and will override other css style sheets placed before.

Parameters:
Name Type Description
selector string

the selector to apply rule to

property string | object

a property or a key, value array of properties you want to set

value string | null | undefined

the value you want to set, if undefined will return the current value, if null remove the property

Source:
layout/jCSSRule.js
Returns:

the object or the property value id value is undefined

Type
Object | string
Example
// Change background color of the body
jCSSRule("body", "background","red");
// Get propertie > return "red"
jCSSRule("body", "background");
// Set multiple properties
jCSSRule("body", {"background":"red", "color":"blue"});
// Remove previous value
jCSSRule("body", "background",null);
// Remove all values
jCSSRule("*", null);

<inner> lightenColor(color, inc)

Get a lighter color

Parameters:
Name Type Description
color Array.<number>

color string as color array

inc number

increment, default 5

Source:
layout/jCSSRule.js