File tree Expand file tree Collapse file tree 7 files changed +26
-15
lines changed
Expand file tree Collapse file tree 7 files changed +26
-15
lines changed Original file line number Diff line number Diff line change 22// SPDX-License-Identifier: MIT
33
44// sizes
5- $em : (18 / 16 ) * 1rem ;
5+ $em : calc (18 / 16 ) * 1rem ;
66$spacing : 18px ;
77
88// fonts
Original file line number Diff line number Diff line change @@ -61,8 +61,8 @@ label {
6161input [type = " submit" ],
6262input [type = " reset" ],
6363button {
64- background : darken ($white , 5 );
65- color : darken ($gray , 25 );
64+ background : safe-adjust-lightness ($white , - 5 );
65+ color : safe-adjust-lightness ($gray , - 25 );
6666 cursor : pointer ;
6767 display : inline ;
6868 margin-bottom : $em ;
@@ -71,16 +71,15 @@ button {
7171 text-align : center ;
7272
7373 & :hover {
74- background : darken ($white , 15 );
74+ background : safe-adjust-lightness ($white , - 15 );
7575 color : $black ;
7676 }
7777
7878 & [disabled ] {
79- background : darken ($white , 10 );
80- color : darken ($gray , 10 );
79+ background : safe-adjust-lightness ($white , - 10 );
80+ color : safe-adjust-lightness ($gray , - 10 );
8181 cursor : not-allowed ;
8282 }
83-
8483}
8584
8685input [type = " submit" ],
@@ -89,8 +88,8 @@ button[type="submit"] {
8988 color : $white ;
9089
9190 & :hover {
92- background : darken ($blue , 15 );
93- color : darken ($white , 25 );
91+ background : safe-adjust-lightness ($blue , - 15 );
92+ color : safe-adjust-lightness ($white , - 25 );
9493 }
9594}
9695
Original file line number Diff line number Diff line change 1+ @use " sass:color" ;
2+
3+ /// Adjusts lightness of a color by a percentage.
4+ /// Positive `$percent` lightens, negative darkens.
5+ ///
6+ /// @param {Color} $color - Base color.
7+ /// @param {Number} $percent - Percent to adjust lightness (e.g. 15 or -15).
8+ /// @return {Color} - Modified color.
9+ @function safe-adjust-lightness ($color , $percent ) {
10+ @return color .adjust ($color , $lightness : $percent * 1% );
11+ }
Original file line number Diff line number Diff line change 2424body {
2525 @extend %sans-serif ;
2626 background : $white ;
27- color : lighten ($black , 10 );
27+ color : safe-adjust-lightness ($black , 10 );
2828 padding : 2 * $spacing ;
2929}
3030
@@ -62,7 +62,7 @@ footer {
6262
6363article {
6464 background : $white ;
65- border : 1px solid lighten ($black , 85 );
65+ border : 1px solid safe-adjust-lightness ($black , 85 );
6666}
6767
6868nav {
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ output {
1414}
1515
1616pre {
17- border-left : .1 * $em solid lighten ($green , 25 );
17+ border-left : .1 * $em solid safe-adjust-lightness ($green , 25 );
1818 line-height : 1.4 * $em ;
1919 overflow : auto ;
2020 padding-left : $spacing ;
2929
3030code ,
3131kbd {
32- background : lighten ($green , 60 );
32+ background : safe-adjust-lightness ($green , 60 );
3333 border-radius : .2 * $spacing ;
3434 color : $green ;
3535 display : inline-block ;
Original file line number Diff line number Diff line change 1717
1818thead th {
1919 border-bottom : .12 * $em solid $gray ;
20- border-left : .06 * $em solid lighten ($black , 80 );
20+ border-left : .06 * $em solid safe-adjust-lightness ($black , 80 );
2121 padding-bottom : .35 * $em ;
2222
2323 & :first-child {
@@ -27,7 +27,7 @@ thead th {
2727
2828tbody tr {
2929 & :hover {
30- background-color : lighten ($black , 98 );
30+ background-color : safe-adjust-lightness ($black , 98 );
3131 }
3232}
3333
Original file line number Diff line number Diff line change 22// SPDX-License-Identifier: MIT
33
44@import ' defs' ;
5+ @import ' functions' ;
56@import ' common' ;
67@import ' tables' ;
78@import ' forms' ;
You can’t perform that action at this time.
0 commit comments