- Theme Engine
- Design Principles
- Templates
- EVML Reference
- Output
- Comments
- Operators
- Statements and Declarations
- Built-in Functions
- Built-in Objects
- Account
- Address
- Array
- Boolean
- Branch
- Cart
- CartLine
- Category
- CategoryCollection
- CategoryFilter
- CategoryFilterCollection
- CategoryFilterOption
- CategorySearch
- Collection
- Color
- Contact
- Currency
- Date
- Discount
- Dom
- Event
- EventCollection
- EventSlot
- Image
- Layout
- Locale
- Money
- Number
- Object
- Page
- PageCollection
- PageSearch
- PageSharer
- Pagination
- Postage
- Price
- PriceDiscount
- Product
- ProductCollection
- ProductCustomisation
- ProductDownload
- ProductMedia
- ProductMediaFrame
- ProductPrice
- ProductSearch
- ProductSpecification
- ProductSpecificationValue
- ProductVariation
- ProductVariationOption
- RecentlyViewed
- RegExp
- Request
- Review
- ReviewCollection
- Search
- SearchCollection
- SearchResult
- String
- Tag
- Template
- Url
- Website
- EV Tags
- CSS Pre-processor
- Ajax API
Color
Extends Object.
Instantiation
You can instantiate a new Color object by supplying a hexadecimal value, or a string:
<?ev
// new Color() using hexadecimal
var red = new Color('#ff0000');
// new Color() using a string
var red = new Color('red');
?>
Construct parameters | |
---|---|
color |
If the color supplied is a valid hexadecimal value, the Color object will return the hexadecimal value.
If the color supplied is not a valid hexadecimal value, but is a known color, the Color object will return
the long hexadecimal value.
If the color supplied is not a valid hexadecimal value, nor is it a known color, the Color object will generate and return a hexadecimal value.
|
Methods | |
---|---|
darken([Number:amount]) |
Returns Color The amount parameter is optional and will default to 10. Decrease the light value (100% to 0%) of your color by the amount provided, a new color object with the new hexadecimal value will be returned.
|
hex() |
Returns String Returns the hexadecimal value as a string with the '#' prefix. |
isDark([Number:threshold]) |
Returns Boolean The threshold parameter is optional and will default to 130. If your color's light value (0 to 255) is less than or equal to the threshold, the method will return true.
|
isLight([Number:threshold]) |
Returns Boolean The threshold parameter is optional and will default to 130. If your color's light value (0 to 255) is greater than the threshold, the method will return true.
|
lighten([Number:amount]) |
Returns Color The amount parameter is optional and will default to 10. Increase the light value (0% to 100%) of your color by the amount provided, a new color object with the new hexadecimal value will be returned.
|
opacity([Number:amount]) |
Returns Color Set the opacity value of your color from 0 (transparent) to 100 (opaque), a new color object with the new rgba value will be returned
|
rgb() |
Returns Array Returns the red, green and blue values of your color in an array. |
rgba() |
Returns Array Returns the red, green, blue and alpha values of your color in an array. |
toString() |
Returns String If an opacity has been applied to the color, this method returns the rgba as a comma-seperated string, wrapped within "rgba()". Otherwise, this method returns the hexadecimal value as a string.
|