lotivis-colors
Colors for lotivis.js.
let data = [ /* */ ];
let colorsGenerator = lotivis.colorsGenerator(data);
let labelColor = colorsGenerator.label("label-1");
Installing
If you use npm, npm install lotivis-colors
. You can also download the latest realease on GitHub. For using in browsers, you can load the UMD bundle from an npm-based CDN such as jsDelivr.
<script src="https://cdn.jsdelivr.net/..."></script>
<script>
let dataController = lotivis.dataController();
</script>
API Reference
Colors Generator
let data = [ /* */ ];
let colorsGenerator = lotivis.colorsGenerator(data);
// receive color for a specific label
let labelColor = colorsGenerator.label("label-1");
// receive color for a specific group
let groupColor = colorsGenerator.group("group-1");
// change data of generator
colorsGenerator.data(otherData);
// change color scheme of generator
colorsGenerator.colorScheme(lotivis.colorSchemeTableau10);
data(_)
colorsGenerator.Gets or sets the generators data.
colorScheme(_)
colorsGenerator.Gets or sets the generators color scheme.
group(group)
colorsGenerator.Returns the color for the specified group
.
label(label)
colorsGenerator.Returns the color for the specified label
.
Color Scales
colorScale(...colors)
lotivis.Returns a generated color scale from the specified colors.
colorScale1
lotivis.Colro scale with "Yellow", "Orange", "Red" and "Purple".
colorScale2
lotivis.Color scale with "White", colorSchemeDefault[2] and colorSchemeDefault[0].
Color Schemes
A color scheme is an array of HTML colors.
colorSchemeLotivis10
lotivis.[
"RoyalBlue",
"MediumSeaGreen",
"MediumPurple",
"Violet",
"Orange",
"Tomato",
"Turquoise",
"LightGray",
"Gray",
"BurlyWood",
]
colorSchemeCategory10
lotivis.Copy of d3.schemeCategory10
.
colorSchemeTableau10
lotivis.Copy of d3.colorSchemeTableau10
.
colorSchemeDefault
lotivis.Copy of colorSchemeCategory10
.
tintColor
lotivis.Holds the first color of th default color scheme (colorSchemeDefault
).
Development`
# build module
yarn build
# develop module
yarn build:watch