
//------------------------------------------------------------------------------
// Colors
//------------------------------------------------------------------------------

// Colors
$o-color-palette: nth($o-color-palettes, $o-color-palette-number) !default;
@function palette-color($key) {
    @return map-get($o-color-palette, $key);
}

// Theme colors
$o-theme-color-palette: nth($o-theme-color-palettes, $o-theme-color-palette-number) !default;
$-main-color: map-get($o-theme-color-palette, 'alpha');
$-main-color-lightness: lightness($-main-color);
$o-theme-color-palette: map-merge((
    // alpha and beta colors are used to override primary and secondary BS4
    // colors by default, so that theme colors affect the default Odoo layouts
    'primary': $-main-color,
    'secondary': map-get($o-theme-color-palette, 'beta'),

    // BS light and dark colors are not used for any BS component, just
    // for color utilities. By default, we set them to a very light and
    // very dark version of a desaturate version of the main color
    'light': lighten(desaturate($-main-color, 80%), min(70%, max(0%, 97% - $-main-color-lightness))), // Does not increase over 97% lightness
    'dark': darken(desaturate($-main-color, 80%), min(70%, max(0%, $-main-color-lightness - 10%))), // Does not lower under 10% lightness
), o-map-omit($o-theme-color-palette));
@function palette-theme-color($key) {
    @return map-get($o-theme-color-palette, $key);
}

// Gray colors
// Extend grays with transparent ones (for some reason, BS4 create black-50 and
// white-50 but does not allow overridding that with variables).
$o-gray-color-palette: nth($o-gray-color-palettes, $o-gray-color-palette-number) !default;
$o-gray-color-palette: map-merge($o-transparent-grays, $o-gray-color-palette);
@function palette-gray($key) {
    @return map-get($o-gray-color-palette, $key);
}
