Sha256: 834a1c52d2439d34c363026be855cec1ecbf9d568af1cde37fd371452448088d

Contents?: true

Size: 593 Bytes

Versions: 12

Compression:

Stored size: 593 Bytes

Contents

module Coprl::Presenters::WebClient::Helpers
  module Color
    def color_classname(comp, affects = nil, color_attr = :color)
      color = comp&.public_send(color_attr)
      return unless color

      return "v-#{comp.type}__primary" if eq(color, :primary)
      return "v-#{comp.type}__secondary" if eq(color, :secondary)

      "v-#{affects}color__#{color}"
    end

    def color_style(comp, affects = nil, color_attr = :color)
      color = comp.public_send(color_attr)
      "#{affects}color: #{color};" unless %w(primary secondary).include?(color.to_s) || color.nil?
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
coprl-3.0.0.beta.12 lib/coprl/presenters/web_client/helpers/color.rb
coprl-3.0.0.beta.11 lib/coprl/presenters/web_client/helpers/color.rb
coprl-3.0.0.beta.10 lib/coprl/presenters/web_client/helpers/color.rb
coprl-3.0.0.beta.9 lib/coprl/presenters/web_client/helpers/color.rb
coprl-3.0.0.beta.8 lib/coprl/presenters/web_client/helpers/color.rb
coprl-3.0.0.beta.7 lib/coprl/presenters/web_client/helpers/color.rb
coprl-3.0.0.beta.6 lib/coprl/presenters/web_client/helpers/color.rb
coprl-3.0.0.beta.5 lib/coprl/presenters/web_client/helpers/color.rb
coprl-3.0.0.beta.4 lib/coprl/presenters/web_client/helpers/color.rb
coprl-3.0.0.beta.3 lib/coprl/presenters/web_client/helpers/color.rb
coprl-3.0.0.beta.2 lib/coprl/presenters/web_client/helpers/color.rb
coprl-3.0.0.beta.1 lib/coprl/presenters/web_client/helpers/color.rb