-
Notifications
You must be signed in to change notification settings - Fork 66
Component: Meter Styling #73
Changes from all commits
a2f2507
9a3af8b
25d5cb2
82732e5
5b44e94
05b7cef
6834d28
f4d3b38
c6d38bc
4f6d7ba
3fe19f4
657c890
f8edb99
8736b7f
cdbe43b
e60d820
61bb3b4
ca93823
42cf9ef
b791b91
0e866ff
4608cdc
5dbdef6
3565924
a111870
3f04bfc
ab7a731
6cc28a7
7345eb9
189024d
f95e683
00ac522
ff4266c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>CSS Chassis - Meter</title> | ||
<link rel="stylesheet" href="../dist/css/chassis.css"> | ||
</head> | ||
<body> | ||
<meter max="100" value="50" class="meter-simple"></meter> | ||
<meter max="100" value="100" class="meter-multicolor"></meter> | ||
<meter max="100" value="50" class="meter-strip"></meter> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/* | ||
* ========================================================================== | ||
* meter | ||
* ========================================================================== | ||
*/ | ||
|
||
@import | ||
"variables"; | ||
|
||
meter { | ||
-webkit-appearance: none; | ||
-moz-appearance: none; | ||
width: 550px; | ||
height: 25px; | ||
margin:10px; | ||
display:block; | ||
box-shadow: inset 0 0 7px -2px rgba(0,0,0,0.35); | ||
background: $meterbar-background-color; | ||
} | ||
|
||
.meter-simple::-webkit-meter-bar, | ||
.meter-multicolor::-webkit-meter-bar, | ||
.meter-strip::-webkit-meter-bar { | ||
box-shadow: inset 0 0 7px -2px rgba(0,0,0,0.35); | ||
background: $meterbar-background-color; | ||
} | ||
|
||
.meter-simple::-webkit-meter-optimum-value { | ||
background: $chassis-blue; | ||
} | ||
|
||
|
||
.meter-multicolor::-webkit-meter-optimum-value { | ||
background-image: linear-gradient( | ||
90deg, | ||
adjust-saturation($color , $percentage) 10%, | ||
adjust-saturation($color , $percentage - 5%) 10%, | ||
adjust-saturation($color , $percentage - 5%) 20%, | ||
adjust-saturation($color , $percentage - 10%) 20%, | ||
adjust-saturation($color , $percentage - 10%) 30%, | ||
adjust-saturation($color , $percentage - 15%) 30%, | ||
adjust-saturation($color , $percentage - 15%) 40%, | ||
adjust-saturation($color , $percentage - 20%) 40%, | ||
adjust-saturation($color , $percentage - 20%) 50%, | ||
adjust-saturation($color , $percentage - 25%) 50%, | ||
adjust-saturation($color , $percentage - 25%) 60%, | ||
adjust-saturation($color , $percentage - 30%) 60%, | ||
adjust-saturation($color , $percentage - 30%) 70%, | ||
adjust-saturation($color , $percentage - 35%) 70%, | ||
adjust-saturation($color , $percentage - 35%) 80%, | ||
adjust-saturation($color , $percentage - 40%) 80%, | ||
adjust-saturation($color , $percentage - 40%) 90%, | ||
adjust-saturation($color , $percentage - 45%) 90%, | ||
adjust-saturation($color , $percentage - 45%) 100% | ||
); | ||
background-size: 100% 100%; | ||
} | ||
|
||
.meter-strip::-webkit-meter-optimum-value { | ||
background-image: linear-gradient( | ||
135deg, | ||
transparent, | ||
transparent 33%, | ||
$chassis-blue 33%, | ||
$chassis-blue 66%, | ||
transparent 66% | ||
); | ||
background-size: 50px 25px; | ||
} | ||
|
||
|
||
|
||
.meter-simple:-moz-meter-optimum::-moz-meter-bar { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the contents of this selector are basically a direct copy of what you have in webkit implementation above (line 31). Why not just list both selectors up above once so you're not repeating the same contents multiple times in your scss file? It will help make customization easier. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My bad, this won't work because firefox/chrome will read part of the selector as being invalid css and ignore it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sfrisk what I do style the meter or progress bar with div tags? |
||
background: $chassis-blue; | ||
} | ||
|
||
|
||
.meter-multicolor:-moz-meter-optimum::-moz-meter-bar { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the contents of this selector are basically a direct copy of what you have in webkit implementation above (line 36). Why not just list both selectors up above once so you're not repeating the same contents multiple times in your scss file? It will help make customization easier. |
||
background-image: linear-gradient( | ||
90deg, | ||
adjust-saturation($color , $percentage) 10%, | ||
adjust-saturation($color , $percentage - 5%) 10%, | ||
adjust-saturation($color , $percentage - 5%) 20%, | ||
adjust-saturation($color , $percentage - 10%) 20%, | ||
adjust-saturation($color , $percentage - 10%) 30%, | ||
adjust-saturation($color , $percentage - 15%) 30%, | ||
adjust-saturation($color , $percentage - 15%) 40%, | ||
adjust-saturation($color , $percentage - 20%) 40%, | ||
adjust-saturation($color , $percentage - 20%) 50%, | ||
adjust-saturation($color , $percentage - 25%) 50%, | ||
adjust-saturation($color , $percentage - 25%) 60%, | ||
adjust-saturation($color , $percentage - 30%) 60%, | ||
adjust-saturation($color , $percentage - 30%) 70%, | ||
adjust-saturation($color , $percentage - 35%) 70%, | ||
adjust-saturation($color , $percentage - 35%) 80%, | ||
adjust-saturation($color , $percentage - 40%) 80%, | ||
adjust-saturation($color , $percentage - 40%) 90%, | ||
adjust-saturation($color , $percentage - 45%) 90%, | ||
adjust-saturation($color , $percentage - 45%) 100% | ||
); | ||
background-size: 100% 100%; | ||
} | ||
|
||
.meter-strip:-moz-meter-optimum::-moz-meter-bar { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the contents of this selector are basically a direct copy of what you have in webkit implementation above (line 62). Why not just list both selectors up above once so you're not repeating the same contents multiple times in your scss file? It will help make customization easier. |
||
background-image: linear-gradient( | ||
135deg, | ||
transparent, | ||
transparent 33%, | ||
$chassis-blue 33%, | ||
$chassis-blue 66%, | ||
transparent 66% | ||
); | ||
background-size: 50px 25px; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* ========================================================================== | ||
* meter variables | ||
* ========================================================================== | ||
*/ | ||
$chassis-blue: #37bfc9; | ||
$meterbar-background-color: #f1f1f1; | ||
|
||
|
||
/* | ||
* For multi color Meter bar | ||
* Scales $color's saturation value by $amount. $amount can be negative. | ||
* scale-saturation($color, $amount) | ||
*/ | ||
|
||
/* This is the staring color, whose the saturation increse with percentage. */ | ||
$color: #3ee3ef; | ||
|
||
/* The starting percentage, which increse the saturation of the color. */ | ||
$percentage: 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you'll need a blank line above the
meter {