GRN2-134: Added Color Input for lighten and darken (#529)

* Added Color Input for lighten and darken

* rspec
This commit is contained in:
farhatahmad
2019-05-22 13:34:37 -04:00
committed by Jesus Federico
parent 1a5cecc0c5
commit 9638ebcbc5
12 changed files with 192 additions and 35 deletions

View File

@ -22,13 +22,16 @@ class ThemesController < ApplicationController
# GET /primary
def index
color = @settings.get_value("Primary Color") || Rails.configuration.primary_color_default
lighten_color = @settings.get_value("Primary Color Lighten") || Rails.configuration.primary_color_lighten_default
darken_color = @settings.get_value("Primary Color Darken") || Rails.configuration.primary_color_darken_default
file_name = Rails.root.join('app', 'assets', 'stylesheets', 'utilities', '_primary_themes.scss')
@file_contents = File.read(file_name)
# Include the variables and covert scss file to css
@compiled = Sass::Engine.new("$primary-color:#{color};" \
"$primary-color-lighten:lighten(#{color}, 40%);" \
"$primary-color-darken:darken(#{color}, 10%);" +
"$primary-color-lighten:#{lighten_color};" \
"$primary-color-darken:#{darken_color};" +
@file_contents, syntax: :scss).render
respond_to do |format|