Type class
Represents a color.
Color
accepts value only in iRGB
object format. To create Color
object by parsing it from any supported string-based formats, use helper color
function:
am4core.color("#ff0000"); am4core.color("#f00"); am4core.color("rgb(255, 0, 0)"); am4core.color("rgba(255, 0, 0, 0.5)"); am4core.color({ r: 255, g: 0, b: 0 }); am4core.color("red");
am4core.color("#ff0000"); am4core.color("#f00"); am4core.color("rgb(255, 0, 0)"); am4core.color("rgba(255, 0, 0, 0.5)"); am4core.color({ r: 255, g: 0, b: 0 }); am4core.color("red");
Click here for color-related info
Sources
Color can be used (imported) via one of the following packages.
/** * -------------------------------------------------------- * Import from: "core.ts" * Use like: am4core.Color * -------------------------------------------------------- */ import * as am4core from "@amcharts/amcharts4/core";
/** * -------------------------------------------------------- * Include via: <script src="core.js"></script> * Access items like: am4.Color * -------------------------------------------------------- */
Inheritance
Color does not extend any other symbol.
Color is not extended by any other symbol.
Properties
alpha # |
Type Set alpha (transparency) of the color. Returns current transparency. |
---|---|
alternative # |
Type Returns a either light or dark color that contrasts specifically with this color. Uses properties Useful when determining which color label should be on a colored background, so that it stands out. |
darkColor # |
Type Sets "dark" color. Used when determining contrasting color. Returns current dark color setting. |
hex # |
Type Returns color hex value string, e.g. "#FF0000". |
lightColor # |
Type Sets "light" color. Used when determining contrasting color. Returns current light color setting. |
rgb # |
Type Returns |
rgba # |
Type Returns an
|
Methods
brighten( percent: ) |
Returns Returns a new Parameter is in the scale of -1 to 1. |
---|---|
constructor( color: ) |
Returns Constructor |
lighten( percent: ) |
Returns Returns a new Parameter is in the scale of -1 to 1. |
saturate( saturation: ) |
Returns Returns a new |
Events
Color does not have any events.
Adapters
Color does not have any adapters.