improvement: rework palette and colors

This commit is contained in:
Kazhnuz 2021-07-25 14:12:29 +02:00
parent 090b42ff1b
commit 1159647c5b
7 changed files with 179 additions and 208 deletions

View file

@ -32,7 +32,7 @@ a.article-nav-link-wrap {
p &:last-child { p &:last-child {
margin-bottom:0; margin-bottom:0;
} }
@include button-color($color-info, $color-button-light); @include button-color($color-info);
} }
.pigimg, .mb { .pigimg, .mb {
@ -54,10 +54,10 @@ nav.pagination {
@include button($button_small); @include button($button_small);
padding-left: $button_small; padding-left: $button_small;
padding-right: $button_small; padding-right: $button_small;
@include button-color($color-light2, $color-button-dark); @include button-color($color-font-light);
&.current { &.current {
@include button-color($color-info, $color-button-light); @include button-color($color-info);
} }
} }
} }
@ -71,7 +71,7 @@ nav.pagination {
input, textarea { input, textarea {
width:100%; width:100%;
background-color:$color-light; background-color:$color-background;
border-radius:0px; border-radius:0px;
border: 1px solid rgba(0,0,0,0.2); border: 1px solid rgba(0,0,0,0.2);
padding:0.375rem; padding:0.375rem;

View file

@ -31,8 +31,8 @@
/* ------------------ HEADERS ------------------- */ /* ------------------ HEADERS ------------------- */
#page-header { #page-header {
background: $color-skyblue url('img/background.png') center bottom repeat-x; background: get-color("skyblue") url('img/background.png') center bottom repeat-x;
border-top: 6px solid $color-dark2; border-top: 6px solid get-color("dark2");
padding-bottom:3rem; padding-bottom:3rem;
.header-collumns { .header-collumns {
@ -75,7 +75,7 @@
header h1 { header h1 {
border-style:none !important; border-style:none !important;
color: $color-light; color: $color-font-light;
font-weight: $fontweight_hyper; font-weight: $fontweight_hyper;
font-size:5.4em; font-size:5.4em;
font-style:oblique; font-style:oblique;
@ -93,9 +93,9 @@ header h1 {
border-left: 0; border-left: 0;
border-right: 0; border-right: 0;
padding: 0.75rem; padding: 0.75rem;
color: $color-light; color: $color-font-light;
a { a {
color: $color-light; color: $color-font-light;
} }
@include li-no-margin(); @include li-no-margin();
} }
@ -197,13 +197,13 @@ header h1 {
/* ------------------ PAGE ------------------- */ /* ------------------ PAGE ------------------- */
#wrapper { #wrapper {
background-color: $color-light; background-color: $color-background;
} }
/* ------------------ FOOTER ------------------- */ /* ------------------ FOOTER ------------------- */
$color-footer-back: $color-dark2; $color-footer-back: get-color("dark2");
$color-footer-text: $color-light; $color-footer-text: $color-font-light;
body { body {
// On colorise le background de la page complete de la même // On colorise le background de la page complete de la même
@ -232,7 +232,7 @@ footer {
a, a:visited { a, a:visited {
&:hover, &:active, &:visited { &:hover, &:active, &:visited {
color: $color-light; color: $color-font-light;
} }
} }

View file

@ -9,107 +9,136 @@
* *
*/ */
$whiteness_value: 0.8;
// Couleurs de base du theme : // Couleurs de base du theme :
$color-blue: #268bd2; $palette: (
$color-violet: #d33682; "blue":#268bd2,
$color-red: #dc322f; "violet":#d33682,
$color-orange: #cb4b16; "red":#dc322f,
$color-green: #859900; "orange":#cb4b16,
$color-skyblue: #2aa198; "green":#859900,
$color-dark: #002b36; "skyblue":#2aa198,
$color-light: #fdf6e3; "dark": #002b36,
$color-yellow: #b58900; "light":#fdf6e3,
$color-grey: #586e75; "yellow":#b58900,
"grey":#586e75,
"dark2":#073642,
"light2":#eee8d5,
"gray2":#657b83,
"gray3":#839496,
"gray4":#93a1a1);
$color-dark2: #073642; $semantics: (
$color-light2: #eee8d5; "font":"dark2",
"font-light":"light",
"background":"light",
"background-alt":"light2",
"link":"skyblue",
"selection":"skyblue",
"mark":"yellow",
"primary":"violet",
"secondary":"skyblue",
"warning":"orange",
"danger":"red",
"info":"skyblue",
"success":"green",
"muted":"grey");
$color-gray2: #657b83; // FUNCTIONS TO GET MORE EASILY COLORS
$color-gray3: #839496; @function get-color($name) {
$color-gray4: #93a1a1; @if map-has-key($semantics, $name) {
@return map-get($palette, map-get($semantics, $name));
$color-primary: $color-violet; } @else {
$color-secondary: $color-skyblue; @return map-get($palette, $name);
}
$color-link: $color-skyblue;
$color-selection: $color-skyblue;
$color-mark: $color-yellow;
$color-font: $color-dark2;
$color-warning: $color-orange;
$color-danger: $color-red;
$color-info: $color-skyblue;
$color-success: $color-green;
@mixin background-color($background-color, $text-color) {
background-color: $background-color!important;
color: $text-color;
} }
@function list-colors() {
$newmap: map-merge($palette, $semantics);
@return $newmap;
}
@function luminance($color) {
$c_red: red($color);
$c_grn: green($color);
$c_blu: blue($color);
$luminance: $c_red*0.299 + $c_grn*0.587 + $c_blu*0.114;
@return $luminance
}
@function getTextColorFromBackground($background-color) {
@if (luminance($background-color) < 255 * $whiteness_value) {
@return $color-font-light;
} @else {
@return $color-font;
}
}
// Couleurs du theme
$color-link: get-color("link");
$color-selection: get-color("selection");
$color-mark: get-color("mark");
$color-font: get-color("font");
$color-font-light: get-color("font-light");
$color-primary: get-color("primary");
$color-secondary: get-color("secondary");
$color-warning: get-color("warning");
$color-danger: get-color("danger");
$color-info: get-color("info");
$color-success: get-color("success");
$color-muted: get-color("muted");
$color-background: get-color("background");
$color-background-alt: get-color("background-alt");
// fonction texte et background
@mixin text-color($text-color) { @mixin text-color($text-color) {
color: $text-color; color: $text-color;
}
@mixin background-color($background-color) {
background-color: $background-color;
color: getTextColorFromBackground($background-color);
} }
// Colorize important elements // Colorize important elements
// Direct uses of colors
a, a:hover, a:active {
color: $color-link;
}
::selection { ::selection {
@include background-color($color-selection, $color-light); @include background-color($color-selection);
} }
::-moz-selection { ::-moz-selection {
@include background-color($color-selection, $color-light); @include background-color($color-selection);
} }
mark { mark {
background-color: lighten($color-mark, 30%) background-color: lighten($color-mark, 30%)
} }
blockquote, pre { blockquote, pre {
border-color: $color-primary; border-color: $color-primary;
} }
// Add generic colorizations classes
/* BACKGROUNDS */
.bg { .bg {
&-blue { @include background-color($color-blue, $color-light); } @each $name, $color in list-colors() {
&-violet { @include background-color($color-violet, $color-light); } &-#{$name} { @include background-color(get-color($name)); }
&-red { @include background-color($color-red, $color-light); } }
&-orange { @include background-color($color-orange, $color-light); }
&-green { @include background-color($color-green, $color-light); }
&-skyblue { @include background-color($color-skyblue, $color-light); }
&-dark { @include background-color($color-dark, $color-light); }
&-light { @include background-color($color-light, $color-dark); }
&-yellow { @include background-color($color-yellow, $color-light); }
&-grey { @include background-color($color-grey, $color-light); }
&-primary { @include background-color($color-primary, $color-light); }
&-secondary { @include background-color($color-secondary, $color-light); }
&-warning { @include background-color($color-warning, $color-light); }
&-danger { @include background-color($color-danger, $color-light); }
&-info { @include background-color($color-info, $color-light); }
&-success { @include background-color($color-success, $color-light); }
} }
/* TEXT */
.text { .text {
&-blue { @include text-color($color-blue); } @each $name, $color in list-colors() {
&-violet { @include text-color($color-violet); } &-#{$name} { @include text-color(get-color($name)); }
&-red { @include text-color($color-red); } }
&-orange { @include text-color($color-orange); }
&-green { @include text-color($color-green); }
&-skyblue { @include text-color($color-skyblue); }
&-dark { @include text-color($color-dark); }
&-light { @include text-color($color-light); }
&-yellow { @include text-color($color-yellow); }
&-grey { @include text-color($color-grey); }
&-primary { @include text-color($color-primary); }
&-secondary { @include text-color($color-secondary); }
&-warning { @include text-color($color-warning); }
&-danger { @include text-color($color-danger); }
&-info { @include text-color($color-info); }
&-success { @include text-color($color-success); }
} }

View file

@ -26,7 +26,7 @@ body {
} }
.night-mode { .night-mode {
color: $color-light2; color: $color-font-light;
} }
strong { strong {
@ -40,8 +40,7 @@ em {
a, a:visited { a, a:visited {
color: $color-light; @include background-color($color-link);
background-color: $color-link;
text-decoration:none; text-decoration:none;
padding:0.05rem; padding:0.05rem;
padding-left:0.25rem; padding-left:0.25rem;
@ -75,9 +74,6 @@ ul, ol {
} }
} }
::selection { background: $color-selection; color: $color-light; }
::-moz-selection { background: $color-selection; color: $color-light; }
/* 2.2 - Text Wrapper */ /* 2.2 - Text Wrapper */
.container-article, .container-typographic { .container-article, .container-typographic {
@ -229,9 +225,8 @@ hr {
padding: $lineheight 1rem $lineheight 1rem; padding: $lineheight 1rem $lineheight 1rem;
max-width: 100%; max-width: 100%;
background-color: $color-light2;
font-style: italic; font-style: italic;
color: $color-dark2; @include background-color($color-background-alt)
} }
blockquote, .quote { blockquote, .quote {
@ -249,7 +244,7 @@ blockquote, .quote {
code { code {
background:transparent; background:transparent;
color: $color-red; color: $color-danger;
} }
.small-text { .small-text {
@ -307,21 +302,7 @@ th {
} }
.table { .table {
&-blue { @include table-color($color-blue); } @each $name, $color in list-colors() {
&-violet { @include table-color($color-violet); } &-#{$name} { @include table-color(get-color($name)); }
&-red { @include table-color($color-red); } }
&-orange { @include table-color($color-orange); }
&-green { @include table-color($color-green); }
&-skyblue { @include table-color($color-skyblue); }
&-dark { @include table-color($color-dark); }
&-light { @include table-color($color-light); }
&-yellow { @include table-color($color-yellow); }
&-grey { @include table-color($color-grey); }
&-primary { @include table-color($color-primary); }
&-secondary { @include table-color($color-secondary); }
&-warning { @include table-color($color-warning); }
&-danger { @include table-color($color-danger); }
&-info { @include table-color($color-info); }
&-success { @include table-color($color-success); }
} }

View file

@ -4,8 +4,8 @@
* *
*/ */
$color-button-light: $color-light; $color-button-light: $color-background;
$color-button-dark: $color-dark; $color-button-dark: get-color("dark");
$button_large: $lineheight; $button_large: $lineheight;
$button_small: $lineheight_quarter; $button_small: $lineheight_quarter;
@ -46,28 +46,29 @@ $button_small: $lineheight_quarter;
} }
} }
@mixin colorize-button($background-color, $text-color) { @mixin colorize-button($background-color) {
//@include background-color($background-color, $text-color);
color: $text-color;
&:before { &:before {
background-color: $background-color; background-color: $background-color;
} }
} }
@mixin button-fullcontrol($background-color, $hover-color, $text-color) { @mixin button-fullcontrol($background-color, $hover-color, $text-color) {
@include colorize-button($background-color, $text-color); @include colorize-button($background-color);
color:$text-color;
&:visited { &:visited {
@include colorize-button($background-color, $text-color); @include colorize-button($background-color);
color:$text-color;
} }
&, &:visited, &:not(.disabled):not(:disabled) { &, &:visited, &:not(.disabled):not(:disabled) {
&:hover, &:active, &:focus, a:hover > &, a:active > &, a:focus > & { &:hover, &:active, &:focus, a:hover > &, a:active > &, a:focus > & {
@include colorize-button($hover-color, lighten($text-color, 5%)); @include colorize-button($hover-color);
color:lighten($text-color, 5%);
} }
} }
} }
@mixin button-color($background-color, $text-color) { @mixin button-color($background-color) {
@include button-fullcontrol($background-color, darken($background-color, 7.5%), $text-color) @include button-fullcontrol($background-color, darken($background-color, 7.5%), getTextColorFromBackground($background-color));
} }
.btn { .btn {
@ -97,13 +98,13 @@ $button_small: $lineheight_quarter;
// NAVBAR SPECIAL BUTTONS // NAVBAR SPECIAL BUTTONS
.btn-navbar { .btn-navbar {
@include button-fullcontrol(transparent, rgba(0,0,0,0.1), $color-light); @include button-fullcontrol(transparent, rgba(0,0,0,0.1), $color-font-light);
padding-left: $button_small; padding-left: $button_small;
padding-right: $button_small; padding-right: $button_small;
} }
.btn-readmore { .btn-readmore {
@include button-fullcontrol(transparent, rgba(0,0,0,0.05), $color-primary); @include button-fullcontrol(transparent, rgba(0,0,0,0.05), $color-font-light);
} }
// BUTTONS GROUPS // BUTTONS GROUPS
@ -142,7 +143,7 @@ ul.breadcrumb, ol.breadcrumb, .breadcrumb {
a, & > span { a, & > span {
display:inline-block; display:inline-block;
@include button($button-large); @include button($button-large);
@include button-fullcontrol($color-light2, darken($color-light2, 5%), $color-dark2); @include button-fullcontrol($color-background-alt, darken($color-background-alt, 5%), get-color("dark2"));
margin:0 $button-large/2.5 0 $button-large/2.5; margin:0 $button-large/2.5 0 $button-large/2.5;
&:before { &:before {
@ -151,34 +152,22 @@ ul.breadcrumb, ol.breadcrumb, .breadcrumb {
} }
&.active { &.active {
@include button-fullcontrol($color-primary, $color-primary, $color-light); @include button-fullcontrol($color-primary, $color-primary, $color-font-light);
} }
} }
} }
// COLORIZE BUTTONS // COLORIZE BUTTONS
.btn, a.btn, .badge, .chip, a.chip, a.badge, .label, a.label, label.label { .btn, a.btn, .badge, .chip, a.chip, a.badge, .label, a.label, label.label {
&-blue { @include button-color($color-blue, $color-button-light); } @each $name, $color in list-colors() {
&-violet { @include button-color($color-violet, $color-button-light); } &-#{$name} { @include button-color(get-color($name)); }
&-red { @include button-color($color-red, $color-button-light); } }
&-orange { @include button-color($color-orange, $color-button-light); } &-link {
&-green { @include button-color($color-green, $color-button-light); } @include button-color(transparent);
&-skyblue { @include button-color($color-skyblue, $color-button-light); } color:$color-font!important;
&-dark { @include button-color($color-dark, $color-button-light); } }
&-light { @include button-color($color-light2, $color-button-dark); }
&-yellow { @include button-color($color-yellow, $color-button-light); }
&-grey { @include button-color($color-grey, $color-button-light); }
&-primary { @include button-color($color-primary, $color-button-light); }
&-secondary { @include button-color($color-secondary, $color-button-light); }
&-warning { @include button-color($color-warning, $color-button-light); }
&-danger { @include button-color($color-danger, $color-button-light); }
&-info { @include button-color($color-info, $color-button-light); }
&-success { @include button-color($color-success, $color-button-light);}
&-link {@include button-color(transparent, $color-dark);}
} }
/* ------------------ PARTAGE RESEAUX SOCIAUX ------------------- */ /* ------------------ PARTAGE RESEAUX SOCIAUX ------------------- */
@ -192,9 +181,9 @@ ul.breadcrumb, ol.breadcrumb, .breadcrumb {
text-align:right; text-align:right;
} }
.btn, a.btn { .btn, a.btn {
&-facebook {@include button-color(#3B5998, $color-button-light);} &-facebook {@include button-color(#3B5998);}
&-twitter {@include button-color(#55ACEE, $color-button-light);} &-twitter {@include button-color(#55ACEE);}
&-googleplus {@include button-color(#d34836, $color-button-light);} &-googleplus {@include button-color(#d34836);}
&-diaspora {@include button-color(#313739, $color-button-light);} &-diaspora {@include button-color(#313739);}
&-mastodon {@include button-color(#282c37, $color-button-light);} &-mastodon {@include button-color(#282c37);}
} }

View file

@ -10,7 +10,7 @@ $card-smallpad: $lineheight_half;
@mixin card($size) { @mixin card($size) {
@include border-radius(); @include border-radius();
background-color: $color-light2; background-color: $color-background-alt;
box-shadow: $large-shadow; box-shadow: $large-shadow;
border: none; border: none;
margin:0; margin:0;
@ -42,17 +42,17 @@ $card-smallpad: $lineheight_half;
font-size:1rem; font-size:1rem;
padding:0px; padding:0px;
margin:0px; margin:0px;
color:$color-light; color:$color-font-light;
font-weight: $fontweight_big; font-weight: $fontweight_big;
line-height:$lineheight; line-height:$lineheight;
} }
} }
@mixin card-color($background-color, $text-color) { @mixin card-color($background-color) {
& .card-header, & .menu-header { & .card-header, & .menu-header {
@include background-color($background-color, $text-color); @include background-color($background-color);
&:before { &:before {
@include background-color($background-color, $text-color); @include background-color($background-color);
} }
} }
} }
@ -108,7 +108,7 @@ $card-smallpad: $lineheight_half;
strong { strong {
font-weight: 900; font-weight: 900;
color:$color-dark!important; color:get-color("dark")!important;
} }
&.noflex { &.noflex {
@ -122,16 +122,16 @@ $card-smallpad: $lineheight_half;
a, a:visited { a, a:visited {
text-decoration:none; text-decoration:none;
color: $color-violet; color: $color-primary;
background-color:transparent; background-color:transparent;
&:hover { &:hover {
text-decoration:none; text-decoration:none;
color: $color-violet; color: $color-primary;
@include biseau($lineheight_half); @include biseau($lineheight_half);
&:before { &:before {
background-color: darken($color-light2, 7.5%) background-color: darken($color-background-alt, 7.5%)
} }
} }
@ -201,51 +201,23 @@ ul.card-list, .card > ul {
/* COLORIZE CARDS and TOASTS */ /* COLORIZE CARDS and TOASTS */
.card, .smallcard, .menu { .card, .smallcard, .menu {
&-blue { @include card-color($color-blue, $color-light); } @each $name, $color in list-colors() {
&-violet { @include card-color($color-violet, $color-light); } &-#{$name} { @include card-color(get-color($name)); }
&-red { @include card-color($color-red, $color-light); } }
&-orange { @include card-color($color-orange, $color-light); }
&-green { @include card-color($color-green, $color-light); }
&-skyblue { @include card-color($color-skyblue, $color-light); }
&-dark { @include card-color($color-dark, $color-light); }
&-light { @include card-color($color-light2, $color-dark); }
&-yellow { @include card-color($color-yellow, $color-light); }
&-grey { @include card-color($color-grey, $color-light); }
&-primary { @include card-color($color-primary, $color-light); }
&-secondary { @include card-color($color-secondary, $color-light); }
&-warning { @include card-color($color-warning, $color-light); }
&-danger { @include card-color($color-danger, $color-light); }
&-info { @include card-color($color-info, $color-light); }
&-success { @include card-color($color-success, $color-light); }
} }
.toast { .toast {
&-blue { @include background-color($color-blue, $color-light); } @each $name, $color in list-colors() {
&-violet { @include background-color($color-violet, $color-light); } &-#{$name} { @include background-color(get-color($name)); }
&-red { @include background-color($color-red, $color-light); } }
&-orange { @include background-color($color-orange, $color-light); }
&-green { @include background-color($color-green, $color-light); }
&-skyblue { @include background-color($color-skyblue, $color-light); }
&-dark { @include background-color($color-dark, $color-light); }
&-light { @include background-color($color-light2, $color-dark); }
&-yellow { @include background-color($color-yellow, $color-light); }
&-grey { @include background-color($color-grey, $color-light); }
&-primary { @include background-color($color-primary, $color-light); }
&-secondary { @include background-color($color-secondary, $color-light); }
&-warning { @include background-color($color-warning, $color-light); }
&-danger { @include background-color($color-danger, $color-light); }
&-info { @include background-color($color-info, $color-light); }
&-success { @include background-color($color-success, $color-light); }
a, a:visited { a, a:visited {
color: $color-light; color: $color-font-light;
background-color:rgba(0,0,0,0.15); background-color:rgba(0,0,0,0.15);
text-decoration:none; text-decoration:none;
opacity:1; opacity:1;
&:hover, &:active, &:visited { &:hover, &:active, &:visited {
color: $color-light; color: $color-font-light;
background-color:transparent; background-color:transparent;
opacity:1; opacity:1;
} }

View file

@ -80,7 +80,7 @@ $preview-height: 8*$lineheight;
transition: background-color 0.3s; transition: background-color 0.3s;
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {
color: $color-light; color: $color-font-light;
font-size: 1rem; font-size: 1rem;
line-height: $lineheight; line-height: $lineheight;
font-weight:$fontweight_big; font-weight:$fontweight_big;
@ -145,7 +145,7 @@ $preview-height: 8*$lineheight;
} }
.preview-metadata { .preview-metadata {
color: $color-light; color: $color-font-light;
height:165px; height:165px;
overflow: hidden; overflow: hidden;
@ -163,22 +163,22 @@ $preview-height: 8*$lineheight;
.card-preview.card-info { .card-preview.card-info {
.comment-text { .comment-text {
@include angled-edge('outside top', 'upper left', $color-skyblue, 16); @include angled-edge('outside top', 'upper left', $color-info, 16);
background-color:$color-skyblue; background-color:$color-info;
} }
} }
.card-preview.card-grey { .card-preview.card-grey {
.comment-text { .comment-text {
@include angled-edge('outside top', 'upper left', $color-grey, 16); @include angled-edge('outside top', 'upper left', $color-muted, 16);
background-color:$color-grey; background-color:$color-muted;
} }
} }
.comment-text { .comment-text {
@include angled-edge('outside top', 'upper left', $color-violet, 16); @include angled-edge('outside top', 'upper left', $color-primary, 16);
color: $color-light; color: $color-font-light;
background-color:$color-violet; background-color:$color-primary;
text-align: center; text-align: center;
} }