Output o-colors
CSS.
all o-colors
styles.
@include oColors();
only o-colors
CSS custom properties ("CSS variables") for palette colours and usecases.
@include oColors($opts: (
'palette-custom-properties': true,
'usecase-custom-properties': true
));
only o-colors
classes for usecases.
@include oColors($opts: (
'usecase-classes': true
));
Return the CSS color for a palette color name.
Return the defined palette color for a use case / property combination
Returns a brighter or darker tone of a colour, where the hue remains the same but the saturation and luminance changes.
Not all our colours allow tones. If a colour cannot be toned an error is thrown. You may however mix the colour with another supported colour.
Figure out if a given colour is a tone. If it is a tone return the original colour name and its tone brightness, otherwise return null.
the tone brightness of 'claret-80'
$tone-details: oColorsGetToneDetails('claret-80');
$color-name: map-get($tone-details, 'color-name'); // claret
$brightness: map-get($tone-details, 'brightness'); // 80
Returns a color based on the background context and base color at the supplied percentage
Returns a text color based on the background and an opacity percentage the color should appear at
Work out the brightness value in % of a color From: https://gist.github.com/jlong/f06f5843104ee10006fe
Returns the luminance of $color
as a float (between 0 and 1)
1 is pure white, 0 is pure black.
From: https://css-tricks.com/snippets/sass/luminance-color-function/
Calculate the contrast ratio between two colours.
Get a list of palette colour details, including the colour name.
Define a new palette color.
Add a custom palette color
@include oColorsSetColor($color-name: 'o-example/pink', $color-value: #ff69b4);
Deprecate a set colour (removing a color from the palette is considered a breaking change and requires a major release).
@include oColorsSetColor (
$color-name: 'o-example/pink',
$color-value #ff69b4,
$opts: (
'allow-tones': true,
'deprecated': 'your deprecation message'
)
);
Add a custom use case property.
a 'stripe' usecase with background, text, and border colour within a component 'o-example'.
@include oColorsSetUseCase('o-example/stripe', (
'text': 'white',
'background': 'black',
'border': 'black-50'
));
a custom colour to a 'stripe' usecase with background.
@include oColorsSetColor('o-example/my-pink', #ff69b4);
@include oColorsSetUseCase('o-example/stripe', (
'background': 'o-example/my-pink',
));
all usecase properties (removing a colour usecase is a breaking change).
@include oColorsSetUseCase('o-example/stripe', (
'text': 'white',
'background': 'black',
'border': 'black-50'
), (deprecated: 'o-example has no stripes anymore.'));
particular usecase properties e.g. "border" (removing a usecase property is a breaking change).
@include oColorsSetUseCase('o-example/stripe', (
'text': 'white',
'background': 'black',
'border': 'black-50',
), ('deprecated': ('border': 'o-example stripes have no border anymore.')));
Output o-colors
CSS.
all o-colors
styles.
@include oColors();
only o-colors
CSS custom properties ("CSS variables") for palette colours and usecases.
@include oColors($opts: (
'palette-custom-properties': true,
'usecase-custom-properties': true
));
only o-colors
classes for usecases.
@include oColors($opts: (
'usecase-classes': true
));