Sha256: 12e3d58177d03e387f7babf0718e61d81a4ac922699bf56a4f03b1145ca31ced

Contents?: true

Size: 508 Bytes

Versions: 1

Compression:

Stored size: 508 Bytes

Contents

# frozen_string_literal: true

module TNS
  module Output
    # Output a given color as CSS property (aka. variable).
    class CSS
      def initialize(name)
        @name = name
      end

      def format(palette)
        palette
          .map { |variant| format_variant(variant) }
          .map(&:to_s)
          .map { |string| "#{string};" }
          .join("\n")
      end

      def format_variant(variant)
        "--#{@name}-#{variant.index * 100}: #{variant.to_css}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tints-n-shades-0.1.0 lib/tns/output/css.rb