mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 02:53:41 +08:00
c937afc75e
A first step to adding automatic dark mode color scheme switching. Adds a new SCSS file at `color_definitions.scss` that serves to output all SCSS color variables as CSS custom properties. And replaces all SCSS color variables with the new CSS custom properties throughout the stylesheets. This is an alpha feature at this point, can only be enabled via console using the `default_dark_mode_color_scheme_id` site setting.
284 lines
5.2 KiB
SCSS
284 lines
5.2 KiB
SCSS
// --------------------------------------------------
|
|
// Buttons
|
|
// --------------------------------------------------
|
|
|
|
// Base
|
|
// --------------------------------------------------
|
|
|
|
@mixin btn(
|
|
$text-color: var(--primary),
|
|
$bg-color: var(--primary-low),
|
|
$icon-color: var(--primary-high),
|
|
$hover-text-color: var(--secondary),
|
|
$hover-bg-color: var(--primary-medium),
|
|
$hover-icon-color: var(--primary-low)
|
|
) {
|
|
display: inline-block;
|
|
margin: 0;
|
|
padding: 6px 12px;
|
|
min-height: 30px;
|
|
border: none;
|
|
box-sizing: border-box;
|
|
font-weight: normal;
|
|
color: $text-color;
|
|
background: $bg-color;
|
|
font-size: $font-0;
|
|
line-height: $line-height-small;
|
|
text-align: center;
|
|
cursor: pointer;
|
|
transition: all 0.25s;
|
|
.d-icon {
|
|
color: $icon-color;
|
|
margin-right: 0.45em;
|
|
transition: color 0.25s;
|
|
line-height: $line-height-medium; // Match button text line-height
|
|
}
|
|
&.no-text {
|
|
.d-icon {
|
|
margin-right: 0;
|
|
}
|
|
}
|
|
@include hover {
|
|
background: $hover-bg-color;
|
|
color: $hover-text-color;
|
|
.d-icon {
|
|
color: $hover-icon-color;
|
|
}
|
|
}
|
|
&[href] {
|
|
color: $text-color;
|
|
}
|
|
&:active,
|
|
&.btn-active {
|
|
@include linear-gradient($hover-bg-color 0%, $bg-color 100%);
|
|
}
|
|
&[disabled],
|
|
&.disabled {
|
|
opacity: 0.4;
|
|
&:hover {
|
|
color: $text-color;
|
|
background: $bg-color;
|
|
.d-icon {
|
|
color: $icon-color;
|
|
}
|
|
}
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.loading-container {
|
|
display: none;
|
|
margin: 0 6.75px 0 0;
|
|
}
|
|
|
|
&.is-loading {
|
|
&.btn-text {
|
|
.d-button-label {
|
|
font-size: $font-down-2;
|
|
}
|
|
|
|
&.btn-small {
|
|
.loading-icon {
|
|
font-size: $font-down-1;
|
|
margin-right: 0.2em;
|
|
}
|
|
}
|
|
}
|
|
|
|
.loading-icon {
|
|
-webkit-animation: rotate-forever 1s infinite linear, fadein 1s;
|
|
animation: rotate-forever 1s infinite linear, fadein 1s;
|
|
}
|
|
}
|
|
}
|
|
|
|
.btn.hidden {
|
|
display: none;
|
|
}
|
|
|
|
// Default button
|
|
// --------------------------------------------------
|
|
|
|
.btn {
|
|
@include btn;
|
|
}
|
|
|
|
// Primary button
|
|
// --------------------------------------------------
|
|
|
|
.btn-primary {
|
|
@include btn(
|
|
$text-color: var(--secondary),
|
|
$bg-color: var(--tertiary),
|
|
$icon-color: var(--secondary),
|
|
$hover-bg-color: var(--tertiary-hover),
|
|
$hover-icon-color: var(--secondary)
|
|
);
|
|
}
|
|
|
|
// Danger button
|
|
// --------------------------------------------------
|
|
|
|
.btn-danger {
|
|
@include btn(
|
|
$text-color: var(--secondary),
|
|
$bg-color: var(--danger),
|
|
$icon-color: var(--danger-low),
|
|
$hover-bg-color: var(--danger-hover),
|
|
$hover-icon-color: var(--danger-low)
|
|
);
|
|
}
|
|
|
|
// ✘ and ✔ buttons
|
|
// --------------------------------------------------
|
|
|
|
.btn.cancel {
|
|
@include btn(
|
|
$text-color: var(--secondary),
|
|
$bg-color: var(--danger),
|
|
$icon-color: var(--secondary),
|
|
$hover-bg-color: var(--danger-hover),
|
|
$hover-icon-color: var(--secondary)
|
|
);
|
|
}
|
|
|
|
.btn.ok {
|
|
@include btn(
|
|
$text-color: var(--secondary),
|
|
$bg-color: var(--success),
|
|
$icon-color: var(--secondary),
|
|
$hover-bg-color: var(--success-hover),
|
|
$hover-icon-color: var(--secondary)
|
|
);
|
|
}
|
|
|
|
// Social buttons
|
|
// --------------------------------------------------
|
|
|
|
.btn-social {
|
|
.d-icon {
|
|
color: #fff;
|
|
}
|
|
color: #fff;
|
|
background: #666;
|
|
&:hover {
|
|
color: #fff;
|
|
}
|
|
&[href] {
|
|
color: var(--secondary);
|
|
}
|
|
&:before {
|
|
margin-right: 9px;
|
|
font-size: $font-0;
|
|
}
|
|
&.google_oauth2 {
|
|
background: var(--google);
|
|
color: #333;
|
|
border: 1px solid var(--primary-low);
|
|
// non-FA SVG icon for Google in login-buttons.hbs
|
|
.d-icon {
|
|
opacity: 0.9;
|
|
}
|
|
&:hover {
|
|
color: currentColor;
|
|
background: var(--google-hover);
|
|
}
|
|
}
|
|
&.instagram {
|
|
background: var(--instagram);
|
|
&:hover {
|
|
background: var(--instagram-hover);
|
|
}
|
|
}
|
|
&.facebook {
|
|
background: $facebook;
|
|
&:hover {
|
|
background: var(--facebook-hover);
|
|
}
|
|
}
|
|
&.cas {
|
|
background: var(--cas);
|
|
}
|
|
&.twitter {
|
|
background: var(--twitter);
|
|
&:hover {
|
|
background: var(--twitter-hover);
|
|
}
|
|
}
|
|
&.github {
|
|
background: var(--github);
|
|
&:hover {
|
|
background: var(--github-hover);
|
|
}
|
|
}
|
|
&.discord {
|
|
background: var(--discord);
|
|
&:hover {
|
|
background: var(--discord-hover);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Button Sizes
|
|
// --------------------------------------------------
|
|
|
|
// Small
|
|
|
|
.btn-small {
|
|
padding: 6px;
|
|
font-size: $font-down-1;
|
|
min-height: 20px;
|
|
.d-icon {
|
|
max-height: 0.87em;
|
|
}
|
|
}
|
|
|
|
// Large
|
|
|
|
.btn-large {
|
|
padding: 9px 18px;
|
|
font-size: $font-up-1;
|
|
line-height: $line-height-small;
|
|
}
|
|
|
|
.btn-flat {
|
|
background: transparent;
|
|
border: 0;
|
|
outline: 0;
|
|
line-height: $line-height-small;
|
|
transition: color 0.25s, background 0.25s;
|
|
.d-icon {
|
|
color: var(--primary-low-mid);
|
|
}
|
|
@include hover {
|
|
.d-icon {
|
|
color: var(--primary);
|
|
}
|
|
}
|
|
&.close {
|
|
padding: 0;
|
|
min-height: unset;
|
|
background: transparent;
|
|
font-size: $font-up-3;
|
|
.d-icon {
|
|
color: var(--primary-high);
|
|
}
|
|
@include hover {
|
|
background: transparent;
|
|
.d-icon {
|
|
color: var(--primary);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.btn-link {
|
|
background: transparent;
|
|
border: 0;
|
|
outline: 0;
|
|
padding: 0;
|
|
color: var(--tertiary);
|
|
&:focus {
|
|
outline: 1px currentColor dotted;
|
|
}
|
|
}
|