@use "helper-functions";
@use "colors_definitions";
@use "sass:color";
@use "sass:map";

@mixin defaultGradient($tone) {
    $default-primary: colors_definitions.$default-primary-dark;
    $default-text: colors_definitions.$default-text-dark;
    $space: "lab";
    @if $tone == "light" {
        $default-primary: colors_definitions.$default-primary-light;
        $default-text: colors_definitions.$default-text-light;
        $space: "srgb-linear";
    }

    --color-base-00: #{$default-primary};
    --color-base-100: #{$default-text};
    --color-space: #{$space};

    --color-base-05: #{color.mix($default-text, $default-primary, $weight: 5%, $method: #{$space})};
    --color-base-10: #{color.mix($default-text, $default-primary, $weight: 10%, $method: #{$space})};
    --color-base-20: #{color.mix($default-text, $default-primary, $weight: 15%, $method: #{$space})};
    --color-base-25: #{color.mix($default-text, $default-primary, $weight: 25%, $method: #{$space})};
    --color-base-30: #{color.mix($default-text, $default-primary, $weight: 30%, $method: #{$space})};
    --color-base-35: #{color.mix($default-text, $default-primary, $weight: 35%, $method: #{$space})};
    --color-base-40: #{color.mix($default-text, $default-primary, $weight: 40%, $method: #{$space})};
    --color-base-50: #{color.mix($default-text, $default-primary, $weight: 50%, $method: #{$space})};
    --color-base-60: #{color.mix($default-text, $default-primary, $weight: 60%, $method: #{$space})};
    --color-base-70: #{color.mix($default-text, $default-primary, $weight: 70%, $method: #{$space})};
    --color-base-80: #{color.mix($default-text, $default-primary, $weight: 80%, $method: #{$space})};
    --color-base-90: #{color.mix($default-text, $default-primary, $weight: 90%, $method: #{$space})};

    @each $color in map.keys(map.get(colors_definitions.$extended-colors, $tone)) {
        $c: helper-functions.map-deep-get(colors_definitions.$extended-colors, $tone, $color);
        --color-#{$color}: #{$c};
        --color-#{$color}-rgb:
            #{color.channel($c, "red", $space: rgb), color.channel($c, "green", $space: rgb),
            color.channel($c, "blue", $space: rgb)};
        --color-#{$color}-hover: color-mix(in srgb, var(--color-#{$color}), rgb(var(--mono-rgb-0)) 20%);
    }
}

@each $tone in ("light", "dark") {
    .is-mobile.theme-#{$tone},
    .theme-#{$tone} {
        @include defaultGradient($tone);
    }

    @media print {
        .fas-theme-#{$tone}-print {
            @include defaultGradient($tone);
        }
    }
}
