// When color definition differs for dark and light variant,
// it gets @if ed depending on $variant

@import 'tweaks-temp';
@import 'color-palette';

@function fade($c) {
  @return mix($c, $grey_900, 50%);
}

@function theme($color) {
  @if ($variant == 'light') {
    @if ($theme == 'default') { @return #1A73E8; }
    @if ($theme == 'purple') { @return $purple-400; }
    @if ($theme == 'pink') { @return $pink-400; }
    @if ($theme == 'red') { @return $red-600; }
    @if ($theme == 'orange') { @return $orange-700; }
    @if ($theme == 'yellow') { @return $yellow-700; }
    @if ($theme == 'green') { @return $green-500; }
    @if ($theme == 'teal') { @return $teal-500; }
    @if ($theme == 'grey') { @return $grey-700; }
  } @else {
    @if ($theme == 'default') { @return #3281EA; }
    @if ($theme == 'purple') { @return $purple-300; }
    @if ($theme == 'pink') { @return $pink-300; }
    @if ($theme == 'red') { @return $red-500; }
    @if ($theme == 'orange') { @return $orange-600; }
    @if ($theme == 'yellow') { @return $yellow-a700; }
    @if ($theme == 'green') { @return $green-400; }
    @if ($theme == 'teal') { @return $teal-300; }
    @if ($theme == 'grey') { @return $grey-600; }
  }
}

// Foreground colors
$dark_fg_color:   rgba($black, 0.87);
$light_fg_color:  $white;
$button_fg_color: if($variant == 'light', rgba($black, 0.62), rgba($white, 0.8)); // extra fg color for raised buttons

$fg_color:                             if($variant == 'light', rgba($black, 0.87), rgba($white, 0.9));
$secondary_fg_color:                   if($variant == 'light', rgba($black, 0.54), rgba($white, 0.7));
$hint_fg_color:                        if($variant == 'light', rgba($black, 0.38), rgba($white, 0.5));
$disabled_fg_color:                    if($variant == 'light', rgba($black, 0.38), rgba($white, 0.5));
$disabled_secondary_fg_color:          if($variant == 'light', rgba($black, 0.26), rgba($white, 0.3));
$track_color:                          if($variant == 'light', rgba($black, 0.2), rgba($white, 0.16));
$visit_color:                          if($variant == 'light', rgba($black, 0.16), rgba($white, 0.1));
$divider_color:                        if($variant == 'light', rgba($black, 0.12), rgba($white, 0.08));
$fill_color:                           if($variant == 'light', rgba($black, 0.06), rgba($white, 0.05));

$titlebar_fg_color:                    if($panel == 'light', rgba($black, 0.87), $white);
$titlebar_secondary_fg_color:          if($panel == 'light', rgba($black, 0.54), rgba($white, 0.7));
$titlebar_hint_fg_color:               if($panel == 'light', rgba($black, 0.38), rgba($white, 0.5));
$titlebar_disabled_fg_color:           if($panel == 'light', rgba($black, 0.38), rgba($white, 0.5));
$titlebar_disabled_secondary_fg_color: if($panel == 'light', rgba($black, 0.26), rgba($white, 0.3));
$titlebar_track_color:                 if($panel == 'light', rgba($black, 0.26), rgba($white, 0.1));
$titlebar_divider_color:               if($panel == 'light', rgba($black, 0.12), rgba($white, 0.06));

$inverse_fg_color:                     rgba($white, 0.85);
$inverse_secondary_fg_color:           rgba($white, 0.7);
$inverse_hint_fg_color:                rgba($white, 0.5);
$inverse_disabled_fg_color:            rgba($white, 0.5);
$inverse_disabled_secondary_fg_color:  rgba($white, 0.3);
$inverse_track_color:                  rgba($white, 0.3);
$inverse_divider_color:                rgba($white, 0.15);

// Background colors
$dark_color:            if($blackness == 'true' and $variant == 'dark', #000000, #202020);
$base_color:            if($variant =='dark', $dark_color, #ffffff);
$alt_base_color:        if($variant =='dark', lighten($base_color, 25%), darken($base_color, 25%));

$dark_bg_color:         rgba($dark_color, 0.9);
$alt_dark_bg_color:     rgba($dark_color, 0.75);
$inverse_bg_color:      rgba($inverse_fg_color, 0.13);
$button_bg_color:       if($variant == 'light', rgba(black, 0.08), rgba(white, 0.06));
$keyboard_bg_color:     if($variant == 'light', $grey_50, fade($grey_700)); // for gnome-shell keyboard
$alt_keyboard_bg_color: if($variant == 'light', $grey_300, fade($grey_900)); // for gnome-shell keyboard

// Misc colors
$primary_color:         theme(color);
$alt_primary_color:     darken($primary_color, 3%);
$accent_color:          lighten($primary_color, 3%);

$panel_bg:              if($blackness == 'true', #000000, #202020);
$panel_bg_color:        if($opacity == 'default', rgba(black, 0.5), $panel_bg);
$panel_fg_color:        if($panel == 'dark', #dedede, #dedede);
$menu_bg_color:         if($opacity == 'default', rgba($base_color, 0.97), $base_color);
$system_bg_color:       if($blackness == 'true' and $variant == 'dark', #121212, #222222);

$link_color:            $primary_color;
$visited_link_color:    if($variant == 'light', $purple-500, $purple-200);

$warning_color:         $orange-a700;
$error_color:           $deep-orange-a700;
$success_color:         $green-a700;

$suggested_color:       $accent_color;
$destructive_color:     $red-a200;

$info_bg_color:         $green-400;
$question_bg_color:     $blue-400;
$warning_bg_color:      $orange-400;
$error_bg_color:        $red-400;

$border_color:          if($variant == 'light', rgba($black, 0.12), rgba($white, 0.12));
$highlight_color:       if($variant == 'light', rgba($white, 0.4),  rgba($white, 0.1));
$alt_highlight_color:   rgba($white, 0.2);
