This script modifies Coloris color pickers in Kanka to suggest the user’s choice of preset colors. This applies to forms such as Events, Connections and Map Markers, as well as in the Theme Builder. Let me know if you find other places that would need this.
The script as released will not make a visible difference. For it to suggest preset colors, you must define them in one of two ways (or both):
Script-side
You can set your palette by editing the customColors
variable in the script itself, following the instructions near the top.
- Values are enclosed in quotation marks and separated by commas like so:
'navy', '#07b', '#123321', 'rgb(244,162,97)'
.
- All standard web color formats are accepted: named, hexadecimal, RGB(A), HSL, etc.
These presets will be shown on every campaign you visit from the current device.
Campaign-side
A palette can also be defined in a campaign by adding a --coloris-presets
custom property to your campaign styles like so:
:root {
--coloris-presets: navy #07b #123321 #00b4d880 rgb(244,162,97) rgba(0,119,182,0.8) hsl(0,100%,50%);
}
This way, if you use the script on multiple browsers/devices, you can configure your palette directly in the campaign and not worry about updating it on every device. Note that spaces act as a separator between values here, so rgb(244, 162, 97)
would be invalid as the script would split it into three parts.
Identical colors from a campaign and your script’s customColors
will be shown only once, so you can take a few colors with you everywhere while keeping campaign-specific ones in the campaign CSS, and not worry about duplicates =)
If my scripts are making your life easier, please consider tipping via Ko-fi (no account needed):