|
@@ 36-46 (lines=11) @@
|
| 33 |
|
end |
| 34 |
|
|
| 35 |
|
# Darkens a color by 10% |
| 36 |
|
def color_darken(color) |
| 37 |
|
# Uses the built in Sass Engine to darken the color |
| 38 |
|
|
| 39 |
|
dummy_scss = "h1 { color: $darken; }" |
| 40 |
|
compiled = Sass::Engine.new("$darken:darken(#{color}, 10%);" + dummy_scss, syntax: :scss).render |
| 41 |
|
|
| 42 |
|
string_locater = 'color: ' |
| 43 |
|
color_start = compiled.index(string_locater) + string_locater.length |
| 44 |
|
|
| 45 |
|
compiled[color_start..color_start + 6] |
| 46 |
|
end |
| 47 |
|
end |
| 48 |
|
|
|
@@ 23-33 (lines=11) @@
|
| 20 |
|
extend ActiveSupport::Concern |
| 21 |
|
|
| 22 |
|
# Lightens a color by 40% |
| 23 |
|
def color_lighten(color) |
| 24 |
|
# Uses the built in Sass Engine to lighten the color |
| 25 |
|
|
| 26 |
|
dummy_scss = "h1 { color: $lighten; }" |
| 27 |
|
compiled = Sass::Engine.new("$lighten:lighten(#{color}, 40%);" + dummy_scss, syntax: :scss).render |
| 28 |
|
|
| 29 |
|
string_locater = 'color: ' |
| 30 |
|
color_start = compiled.index(string_locater) + string_locater.length |
| 31 |
|
|
| 32 |
|
compiled[color_start..color_start + 6] |
| 33 |
|
end |
| 34 |
|
|
| 35 |
|
# Darkens a color by 10% |
| 36 |
|
def color_darken(color) |