// This file is used to define colors that are going to be used to replace
// assets (dummy) colors via colorize-dummy-svg.py

$variant: if($yaru_is_dark_variant, 'dark', 'light');

@import 'colors';

$yaru_colors: (
    bg-color: $bg_color,
    accent-color: $yaru_accent_color,
    accent-bg-color: $yaru_accent_bg_color,
    accent-active-color: $progress_bg_color,
    accent-focused-color: if($variant == 'dark', darken($accent_bg_color, 7%), darken($accent_bg_color, 3%)),
    border-color: $borders_color,
    disabled-bg-color: mix($bg_color, $fg_color, 80%),
    switch-bg-color: if($variant == 'dark', lighten($inkstone, 5%), lighten($ash, 20%)),
    check-bg-color: if($variant == 'dark', lighten($bg_color, 2%), $porcelain),
);

$yaru_colors: map-merge($yaru_colors, (
    accent-border-color: lighten(map-get($yaru_colors, accent-active-color), 17%),
));

@function opaque-color($color, $background: $bg_color) {
    @if alpha($color) == 1 {
        @return $color;
    }

    $percent: alpha($color) * 100%;
    $opaque: opacify($color, 1);
    $solid-color: mix($opaque, $background, $percent);
    @return $solid-color;
}

* {
@each $name, $color in $yaru_colors {
    -yaru-#{$name}: #{$color};

    $opaque: opaque-color($color);
    @if $opaque != $color {
        -yaru-#{$name}-opaque: $opaque;
    }
}
};
