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

@import 'color-palette';

@function gtkalpha($c, $a) {
  @return unquote("alpha(#{$c}, #{$a})");
}

@function fade($c) {
  @return mix($c, $grey_800, 75%);
}

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

$fg_color:                    if($variant == 'light', rgba($brown_700, 0.87), $white);
$secondary_fg_color:          if($variant == 'light', rgba($brown_700, 0.54), rgba($white, 0.7));
$hint_fg_color:               if($variant == 'light', rgba($brown_700, 0.38), rgba($white, 0.5));
$disabled_fg_color:           if($variant == 'light', rgba($brown_700, 0.38), rgba($white, 0.5));
$disabled_secondary_fg_color: if($variant == 'light', rgba($brown_700, 0.26), rgba($white, 0.3));
$track_color:                 if($variant == 'light', rgba($brown_700, 0.26), rgba($white, 0.3));
$divider_color:               if($variant == 'light', rgba($brown_700, 0.12), rgba($white, 0.12));

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

$inverse_fg_color:                    $white;
$inverse_bg_color:                    $brown_800;
$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.12);

// Background colors
$bg_color:         if($variant == 'light', $grey_100, darken($brown_700, 5%));
$base_color:       if($variant == 'light', $white,    darken($brown_700, 7%));
$alt_base_color:   if($variant == 'light', $grey_50,  mix($base_color, $bg_color, 50%));
$alt_bg_color:     $brown_800;
$lighter_bg_color: if($variant == 'light', $grey_50,  $brown_700);
$darker_bg_color:  if($variant == 'light', $grey_200, $brown_800);

$titlebar_bg_color:          if($titlebar == 'dark', if($variant == 'light', $brown_700, lighten($brown_800, 5%)), $brown_300);
$inactive_titlebar_bg_color: if($titlebar == 'dark', if($variant == 'light', fade($brown_700), fade(lighten($brown_800, 5%))), fade($brown_300));
$alt_titlebar_bg_color:      if($titlebar == 'dark', $brown_800, mix($brown_300, $brown_400, 50%));
$panel_bg_color:             darken($brown_800, 3%);
$unity_panel_bg_color:       if($titlebar == 'dark', $brown_900, mix($grey_300, $grey_400, 50%));
$alt_panel_bg_color:         rgba($black, $lower_opacity);

$fill_color:      gtkalpha(currentColor, $lower_opacity);
$semi_fill_color: gtkalpha(currentColor, $lower_opacity / 2);
$row_fill_color:  gtkalpha(currentColor, 0.05);

// Misc colors
$primary_color:         $blue_500;
$alt_primary_color:     $blue_300;
$accent_color:          $orange_A200;
$disabled_accent_color: rgba($accent_color, 0.5);

$link_color:         $orange_500;
$visited_link_color: if($variant == 'dark', $orange_400, $orange_600);

$warning_color: $yellow_500;
$error_color:   $red_500;
$success_color: $green_500;

$suggested_color:   $green_600;
$destructive_color: $red_600;

$info_bg_color:     $green_400;
$question_bg_color: $blue_400;
$warning_bg_color:  $yellow_400;
$error_bg_color:    $red_400;

$border_color:             if($variant == 'light', rgba($black, 0.1),  rgba($black, 0.2));
$highlight_color:          if($variant == 'light', rgba($white, 0.4),  rgba($white, 0.1));
$titlebar_highlight_color: if($titlebar == 'dark', rgba($white, 0.15), rgba($white, 0.4));
$unity_highlight_color:    if($titlebar == 'dark', rgba($white, 0.1),  rgba($white, 0.2));
$alt_highlight_color:      rgba($white, 0.2);
$titlebar_indicator_color: if($titlebar == 'dark', $accent_color, $accent_color);

$placeholder_text_color: if($variant == 'light',
                            mix($black, $base_color, percentage(0.54)),
                            mix($white, $base_color, percentage(0.7)));
