Skip to content

Commit

Permalink
Refactor sass color module
Browse files Browse the repository at this point in the history
  • Loading branch information
renatho committed Oct 31, 2024
1 parent 41ee5ad commit da59ea7
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 49 deletions.
5 changes: 3 additions & 2 deletions assets/admin/students/student-modal/student-modal.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@use "sass:color";
@import '../../../shared/styles/wp-colors';

.sensei-student-modal {
Expand Down Expand Up @@ -57,8 +58,8 @@
box-shadow: inset 0 0 0 1px $alert-red;

&:hover:not(:disabled) {
color: adjust-color($alert-red, $lightness: -20%);
box-shadow: inset 0 0 0 1px adjust-color($alert-red, $lightness: -20%);
color: color.adjust($alert-red, $lightness: -20%);
box-shadow: inset 0 0 0 1px color.adjust($alert-red, $lightness: -20%);
}

&:focus:not(:disabled) {
Expand Down
9 changes: 5 additions & 4 deletions assets/css/course-editor.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@use "sass:color";
@import '~@wordpress/base-styles/breakpoints';

$primary: #6FCFB2;
Expand Down Expand Up @@ -66,14 +67,14 @@ $secondary: #0693e3;

&:hover,
&:active {
background-color: adjust-color($primary, $lightness: 5%);
border-color: adjust-color($primary, $lightness: 5%);
background-color: color.adjust($primary, $lightness: 5%);
border-color: color.adjust($primary, $lightness: 5%);
text-decoration: none;
}

&:focus {
background-color: adjust-color($primary, $lightness: -5%);
border-color: adjust-color($primary, $lightness: -5%);
background-color: color.adjust($primary, $lightness: -5%);
border-color: color.adjust($primary, $lightness: -5%);
box-shadow: 0 0 0 1px #fff, 0 0 0 3px $primary;
}

Expand Down
28 changes: 14 additions & 14 deletions assets/css/frontend.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ $tablet-breakpoint: 768px;
/**
* Functions
*/

@use "sass:color";

/**
* Mixins
Expand Down Expand Up @@ -101,7 +101,7 @@ a.sensei-certificate-link {

.course-author,
.sensei-course-meta {
color: adjust-color($color_body, $lightness: 20%);
color: color.adjust($color_body, $lightness: 20%);
font-size: .9em;

a {
Expand Down Expand Up @@ -150,7 +150,7 @@ a.sensei-certificate-link {
p.lesson-meta {
font-style: italic;
font-size: .9em;
color: adjust-color($color_body, $lightness: 20%);
color: color.adjust($color_body, $lightness: 20%);

a {
color: #555;
Expand Down Expand Up @@ -228,7 +228,7 @@ a.sensei-certificate-link {
@include border_radius(5px);
color: #fff;
font-weight: bold;
background: adjust-color($bg_dark, $lightness: -5%);
background: color.adjust($bg_dark, $lightness: -5%);
display: inline-block;

&:before {
Expand Down Expand Up @@ -274,7 +274,7 @@ a.sensei-certificate-link {
margin: 2em 0;
padding: 0.5em 1em;
font-style: italic;
color: adjust-color($color_body, $lightness: 20%);
color: color.adjust($color_body, $lightness: 20%);
clear: both;

&:before {
Expand All @@ -286,7 +286,7 @@ a.sensei-certificate-link {
.lesson-tags {
margin: 2em 0;
font-style: italic;
color: adjust-color($color_body, $lightness: 20%);
color: color.adjust($color_body, $lightness: 20%);
font-size: .9em;
}

Expand Down Expand Up @@ -932,7 +932,7 @@ section.entry span.course-lesson-progress {
font-size: 16px;
position: relative;
margin: 20px 0; /* Just for demo spacing */
background: adjust-color($bg_light, $lightness: -5%);
background: color.adjust($bg_light, $lightness: -5%);
-moz-border-radius: 25px;
-webkit-border-radius: 25px;
border-radius: 25px;
Expand Down Expand Up @@ -1014,10 +1014,10 @@ section.entry span.course-lesson-progress {
}

a {
color: adjust-color($error, $lightness: -10%);
color: color.adjust($error, $lightness: -10%);

&:hover {
color: adjust-color($error, $lightness: -15%);
color: color.adjust($error, $lightness: -15%);
}
}
}
Expand All @@ -1031,10 +1031,10 @@ section.entry span.course-lesson-progress {
}

a {
color: adjust-color($success, $lightness: -10%);
color: color.adjust($success, $lightness: -10%);

&:hover {
color: adjust-color($success, $lightness: -15%);
color: color.adjust($success, $lightness: -15%);
}
}
}
Expand Down Expand Up @@ -1113,8 +1113,8 @@ section.entry span.course-lesson-progress {
text-transform: uppercase;
float: right;
background: none;
color: adjust-color($success, $lightness: -10%);
border: 2px solid adjust-color($success, $lightness: -10%);
color: color.adjust($success, $lightness: -10%);
border: 2px solid color.adjust($success, $lightness: -10%);

&:hover {
background: $success;
Expand Down Expand Up @@ -1154,7 +1154,7 @@ section.entry span.course-lesson-progress {
}

&:hover {
background: adjust-color($bg_light, $lightness: -3%);
background: color.adjust($bg_light, $lightness: -3%);
}
}
}
Expand Down
15 changes: 8 additions & 7 deletions assets/css/notices.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@use "sass:color";
@import "mixins";

.sensei-lms-notice {
Expand Down Expand Up @@ -51,10 +52,10 @@
}

a {
color: adjust-color($color_body, $lightness: -10%);
color: color.adjust($color_body, $lightness: -10%);

&:hover {
color: adjust-color($color_body, $lightness: -15%);
color: color.adjust($color_body, $lightness: -15%);
}
}
}
Expand All @@ -68,27 +69,27 @@
}

a {
color: adjust-color($error, $lightness: -10%);
color: color.adjust($error, $lightness: -10%);

&:hover {
color: adjust-color($error, $lightness: -15%);
color: color.adjust($error, $lightness: -15%);
}
}
}

&.success {
background: adjust-color( $success, $lightness: 35% );
background: color.adjust( $success, $lightness: 35% );

&:before {
color: $success;
content: '\f058';
}

a {
color: adjust-color($success, $lightness: -10%);
color: color.adjust($success, $lightness: -10%);

&:hover {
color: adjust-color($success, $lightness: -15%);
color: color.adjust($success, $lightness: -15%);
}
}
}
Expand Down
15 changes: 8 additions & 7 deletions assets/css/settings.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@use "sass:color";
@import "mixins";

/*-----------------------------------------------------------------------------------*/
Expand Down Expand Up @@ -306,7 +307,7 @@ table.wp_list_table_grading_mains, {
}

.not-enrolled {
background: adjust-color($bg_light, $lightness: -5%);
background: color.adjust($bg_light, $lightness: -5%);
}

.enrolled {
Expand All @@ -325,7 +326,7 @@ table.wp_list_table_grading_mains, {
table.wp_list_table_grading_mains {
.user_status {
.ungraded {
background: adjust-color($bg_light, $lightness: -5%);
background: color.adjust($bg_light, $lightness: -5%);
}

.in-progress {
Expand Down Expand Up @@ -452,7 +453,7 @@ table.wp_list_table_sensei_learner_admins {
}

.does-not-provide-enrolment {
color: adjust-color($bg_light, $lightness: -40%);
color: color.adjust($bg_light, $lightness: -40%);

&:before {
font-family: dashicons;
Expand Down Expand Up @@ -532,7 +533,7 @@ table.wp_list_table_sensei_learner_admins {
&.user_right {
.grading-mark.icon_right {
&:after {
color: adjust-color($success, $lightness: -15%) !important;
color: color.adjust($success, $lightness: -15%) !important;
}
}

Expand All @@ -546,7 +547,7 @@ table.wp_list_table_sensei_learner_admins {
&.user_wrong {
.grading-mark.icon_wrong {
&:after {
color: adjust-color($error, $lightness: -15%) !important;
color: color.adjust($error, $lightness: -15%) !important;
}
}

Expand Down Expand Up @@ -683,7 +684,7 @@ table.wp_list_table_sensei_learner_admins {

&:hover {
&:after {
color: adjust-color($success, $lightness: -7%);
color: color.adjust($success, $lightness: -7%);
}
}
}
Expand All @@ -696,7 +697,7 @@ table.wp_list_table_sensei_learner_admins {

&:hover {
&:after {
color: adjust-color($error, $lightness: -7%);
color: color.adjust($error, $lightness: -7%);
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions assets/setup-wizard/features/style.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use "sass:color";

$bar-color: #217D7C;

@keyframes bar-animation {
Expand Down Expand Up @@ -30,9 +32,9 @@ $bar-color: #217D7C;
background-color: $bar-color;
background-image: linear-gradient(
135deg,
adjust-color($bar-color, $lightness: 5%) 25%, $bar-color 25%,
$bar-color 50%, adjust-color($bar-color, $lightness: 5%) 50%,
adjust-color($bar-color, $lightness: 5%) 75%, $bar-color 75%
color.adjust($bar-color, $lightness: 5%) 25%, $bar-color 25%,
$bar-color 50%, color.adjust($bar-color, $lightness: 5%) 50%,
color.adjust($bar-color, $lightness: 5%) 75%, $bar-color 75%
);
background-size: 50px 50px;
height: 100%;
Expand Down
17 changes: 9 additions & 8 deletions assets/shared/styles/wp-admin.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@use "sass:color";
@import 'variables';

.button {
Expand All @@ -9,13 +10,13 @@

&:hover,
&:active {
color: adjust-color($primary, $lightness: 5%);
border-color: adjust-color($primary, $lightness: 5%);
color: color.adjust($primary, $lightness: 5%);
border-color: color.adjust($primary, $lightness: 5%);
}

&:focus {
color: adjust-color($primary, $lightness: -5%);
border-color: adjust-color($primary, $lightness: -5%);
color: color.adjust($primary, $lightness: -5%);
border-color: color.adjust($primary, $lightness: -5%);
}
}

Expand All @@ -26,13 +27,13 @@

&:hover,
&:active {
background-color: adjust-color($primary, $lightness: 5%);
border-color: adjust-color($primary, $lightness: 5%);
background-color: color.adjust($primary, $lightness: 5%);
border-color: color.adjust($primary, $lightness: 5%);
}

&:focus {
background-color: adjust-color($primary, $lightness: -5%);
border-color: adjust-color($primary, $lightness: -5%);
background-color: color.adjust($primary, $lightness: -5%);
border-color: color.adjust($primary, $lightness: -5%);
box-shadow: 0 0 0 1px $white, 0 0 0 3px $primary;
}

Expand Down
9 changes: 5 additions & 4 deletions assets/shared/styles/wp-components.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@use "sass:color";
@import 'variables';

@import '~@wordpress/base-styles/colors';
Expand Down Expand Up @@ -40,11 +41,11 @@ body.sensei-color {

&:hover,
&:active {
color: adjust-color($link, $lightness: 20%);
color: color.adjust($link, $lightness: 20%);
}

&:not(.components-button):focus {
color: adjust-color($link, $lightness: -20%);
color: color.adjust($link, $lightness: -20%);
box-shadow: 0 0 0 1px $link-primary, 0 0 2px 1px rgba($link-primary, 0.8);
}
}
Expand All @@ -54,11 +55,11 @@ body.sensei-color {

&:hover,
&:active {
color: adjust-color($link-primary, $lightness: 20%);
color: color.adjust($link-primary, $lightness: 20%);
}

&:focus {
color: adjust-color($link-primary, $lightness: -20%);
color: color.adjust($link-primary, $lightness: -20%);
}
}

Expand Down

0 comments on commit da59ea7

Please sign in to comment.