Color Configuration
$_LOCAL-COLOR-FUNCTIONS (map)
$_LOCAL-COLOR-FUNCTIONS: ( // sass-lint:disable-line variable-name-format
'tint',
'shade',
'contrast',
);
These functions are defined internally,
and can be called by name without first being captured
using the Sass get-function() approach.
Don’t make changes to this map directly.
You can add your own named functions in the $functions map.
Related
Used By
@function _ac-color-get-function() [private]
$functions (map)
$functions: () !default;
Define any additional color functions required
to generate relataionships in the $colors map.
This is only necessary for newer versions of Sass,
where functions are first-class,
and can be captured using get-function($name).
$functions: (
'darken': get-function('darken'),
'lighten': get-function('lighten'),
);
Related
Used By
@function _ac-color-get-function() [private]
$colors
$colors: () !default;
A variable storing the map of
all colors globally-avialble on your project.
Any colors added to the $colors map will be accesible
to the color() function by default.
Define each color with a name, base-value,
and optional adjustments…
$colors: (
'color-name': <base-value>,
'color-two': <base-value> ('<color-function>': '<arguments>'),
// will return: function-name($base-value, $arguments...)
);
- Name your colors anything – from abstractions like
brand-pink, to concrete patterns likebuttonorwidget-background. - Base-values can be CSS-ready colors (hex, rgb, hsla), or references other colors in the map.
- Adjustments are a nested map of color functions and arguments, for adjusting colors directly in your palette.
The color-names contrast-light and contrast-dark are special.
Use those names to define the default light-and-dark options
for our color-contrast tools.
They default to white and black respectively.
Examples
$colors: (
'brand-pink': hsl(330, 85%, 62%),
'brand-light': #fff,
'brand-dark': #222,
);
$colors: (
'background': 'brand-light',
'text': 'brand-dark',
'link': 'brand-pink',
);
$colors: (
'focus': 'link' ('darken': 15%, 'desaturate': 15%),
);
@mixin add-colors()
Merge individual color maps into the global $colors variable,
in case you want to define colors in smaller groups
such as brand-colors, link-colors, etc
before merging them into a single global color-palette.
This can be useful for internal organization,
documentation with SassDoc,
or integration with our pattern-library generator:
Herman.
Parameters & Output
$maps: (map...)
Pass any number of maps to be merged.
{CSS output} (code block)
- An updated global
$colorsvariable, with new maps merged in.
Example
$brand-colors: (
'brand-dark': #222,
'brand-pink': hsl(330, 85%, 62%),
);
$text-colors: (
'text': 'brand-dark',
'link': 'brand-pink',
);
@include add-colors($brand-colors, $text-colors);
@function merge-colors()
Merge multiple color maps into a single map,
in case you want to define colors in smaller groups –
such as brand-colors, link-colors, etc. –
before merging them into a single map.
This is like add-colors,
but returns the combined map
without assigning it to the $colors variable.
Parameters & Return
$maps: (maps...)
Pass any number of maps to be merged.
@return (map)
The merged map of colors.
Example
$brand-colors: (
'brand-dark': #222,
'brand-pink': hsl(330, 85%, 62%),
);
$text-colors: (
'text': 'brand-dark',
'link': 'brand-pink',
);
$colors: merge-colors($brand-colors, $text-colors);