Sha256: c7f94f24847e752570dadefcb7e21073415983adeea967fdb225a7b768c543d4

Contents?: true

Size: 863 Bytes

Versions: 4

Compression:

Stored size: 863 Bytes

Contents

module Chroma
  module Converters
    # Base class for converting one color mode to another.
    # @abstract
    class Base
      include Helpers::Bounders

      # @param input [ColorModes::Rgb, ColorModes::Hsl, ColorModes::Hsv]
      # @return [Base]
      def initialize(input)
        @input = input
      end

      # @param rgb [ColorModes::Rgb]
      # @return [ColorModes::Rgb, ColorModes::Hsl, ColorModes::Hsv]
      def self.convert_rgb(rgb)
        new(rgb).convert_rgb
      end

      # @param hsl [ColorModes::Hsl]
      # @return [ColorModes::Rgb, ColorModes::Hsl, ColorModes::Hsv]
      def self.convert_hsl(hsl)
        new(hsl).convert_hsl
      end

      # @param hsv [ColorModes::Hsv]
      # @return [ColorModes::Rgb, ColorModes::Hsl, ColorModes::Hsv]
      def self.convert_hsv(hsv)
        new(hsv).convert_hsv
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chroma-0.2.0 lib/chroma/converters/base.rb
chroma-0.1.0 lib/chroma/converters/base.rb
chroma-0.0.1 lib/chroma/converters/base.rb
chroma-0.0.1.alpha.3 lib/chroma/converters/base.rb