1
0
mirror of https://github.com/locomotivemtl/locomotive-boilerplate.git synced 2026-01-15 00:55:08 +08:00

Color as list with function

This commit is contained in:
Lucas Vallenet
2023-04-19 15:37:52 +02:00
parent 8aac2ffea6
commit 9a2083d894
11 changed files with 5140 additions and 27 deletions

View File

@@ -27,7 +27,7 @@ $input-icon-color: 424242; // No #
.c-form_input { .c-form_input {
padding: rem(10px); padding: rem(10px);
border: 1px solid lightgray; border: 1px solid lightgray;
background-color: $color-lightest; background-color: color(lightest);
&:hover { &:hover {
border-color: darkgray; border-color: darkgray;
@@ -71,7 +71,7 @@ $checkbox-icon-color: $input-icon-color;
} }
&::before { &::before {
background-color: $color-lightest; background-color: color(lightest);
border: 1px solid lightgray; border: 1px solid lightgray;
} }

View File

@@ -25,7 +25,7 @@
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
background-color: $color-darkest; background-color: color(darkest);
opacity: 0.5; opacity: 0.5;
width: 7px; width: 7px;
border-radius: 10px; border-radius: 10px;

View File

@@ -73,8 +73,8 @@ body {
} }
::selection { ::selection {
background-color: $selection-background-color; background-color: $color-selection-background;
color: $selection-text-color; color: $color-selection-text;
text-shadow: none; text-shadow: none;
} }

View File

@@ -5,24 +5,26 @@
// Palette // Palette
// ============================================================================= // =============================================================================
$color-lightest: #FFFFFF; $colors: (
$color-darkest: #000000; primary: #3297FD,
lightest: #FFFFFF,
darkest: #000000,
);
// Specific
// Specifics
// ============================================================================= // =============================================================================
// Link // Link
$color-link: #1A0DAB; $color-link: color(primary);
$color-link-focus: #1A0DAB; $color-link-focus: color(primary);
$color-link-hover: darken(#1A0DAB, 10%); $color-link-hover: darken(color(primary), 10%);
// Selection // Selection
$selection-text-color: #3297FD; $color-selection-text: color(darkest);
$selection-background-color: #FFFFFF; $color-selection-background: color(lightest);
// Social Colors
// =============================================================================
// Socials
$color-facebook: #3B5998; $color-facebook: #3B5998;
$color-instagram: #E1306C; $color-instagram: #E1306C;
$color-youtube: #CD201F; $color-youtube: #CD201F;

View File

@@ -49,7 +49,7 @@ $font-faces: (
// Base // Base
$font-size: 16px; $font-size: 16px;
$line-height: math.div(24px, $font-size); $line-height: math.div(24px, $font-size);
$font-color: $color-darkest; $font-color: color(darkest);
// Weights // Weights
$font-weight-light: 300; $font-weight-light: 300;

View File

@@ -21,6 +21,11 @@
--font-size-h5: #{rem(18px)}; --font-size-h5: #{rem(18px)};
--font-size-h6: #{rem(16px)}; --font-size-h6: #{rem(16px)};
// // Colors
// @each $color, $value in $colors {
// --color-#{"" + $color}: #{$value};
// }
@media (min-width: $from-small) { @media (min-width: $from-small) {
--grid-columns: #{$base-column-nb}; --grid-columns: #{$base-column-nb};
--grid-gutter: #{rem(16px)}; --grid-gutter: #{rem(16px)};

View File

@@ -139,3 +139,24 @@
} }
$context: 'frontend' !default; $context: 'frontend' !default;
// Returns color code.
//
// ```scss
// .c-box {
// width: color(primary);
// }
// ```
//
// @param {string} $key - The color key in $colors
// @return {function<string>} in hexadecimal
@function color($key) {
@if map-has-key($colors, $key) {
@return map-get($colors, $key);
}
@warn "Unkown '#{$key}' in $colors.";
@return null;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long