Sha256: 2ba720e0a57dfe7efd021c72d7a44acb09bbf38275688baa2ec256c773024d3d

Contents?: true

Size: 579 Bytes

Versions: 6

Compression:

Stored size: 579 Bytes

Contents

module Lookbook
  class Theme

    BASE_THEMES = [:indigo, :zinc, :blue]

    def initialize(config = {})
      @config = config
      @css = nil
    end

    def to_css
      return @css unless @css.nil?
      @css ||= if @config.present?
        styles = [":root {"]
        styles << @config.map do |key, value|
          "  --lookbook-#{key.to_s.underscore.gsub("_","-")}: #{value};"
        end
        styles.push "}"
        styles.join("\n")
      else
        ""
      end
    end

    def self.valid_theme?(name)
      BASE_THEMES.include? name.to_sym
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lookbook-1.0.0.beta.6 lib/lookbook/theme.rb
lookbook-1.0.0.beta.5 lib/lookbook/theme.rb
lookbook-1.0.0.beta.4 lib/lookbook/theme.rb
lookbook-1.0.0.beta.3 lib/lookbook/theme.rb
lookbook-1.0.0.beta.2 lib/lookbook/theme.rb
lookbook-1.0.0.beta.1 lib/lookbook/theme.rb