Sha256: 3fdd2469ea7d4e486f4c0ea52fd41ea04316391603da0225c83f3a34375e950f

Contents?: true

Size: 844 Bytes

Versions: 4

Compression:

Stored size: 844 Bytes

Contents

# encoding: utf-8
require 'fedux_org_stdlib/require_files'
require_library %w(geo_pattern)

module FeduxOrgStdlib
  class Icon
    extend Forwardable

    def_delegator :@icon, :to_data_uri, :to_data_uri

    @patterns = %i(overlapping_rings xes mosaic_squares concentric_circles diamonds tessellation triangles squares)

    # see http://pln.jonas.me/xterm-colors for examples
    @colors = %w(#080808 #121212 #1c1c1c #262626 #303030 #3a3a3a #444444 #4e4e4e
                #585858 #626262 #6c6c6c #767676 #808080 #8a8a8a #949494 #9e9e9e
                #a8a8a8 b2b2b2 #bcbcbc #c6c6c6 #d0d0d0 #dadada #e4e4e4
                #eeeeee)

    class << self
      attr_reader :patterns, :colors
    end

    def initialize(string, color: '#9e9e9e')
      @icon = GeoPattern.generate(string, color: color, patterns: Icon.patterns)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fedux_org-stdlib-0.11.17 lib/fedux_org_stdlib/icon.rb
fedux_org-stdlib-0.11.16 lib/fedux_org_stdlib/icon.rb
fedux_org-stdlib-0.11.15 lib/fedux_org_stdlib/icon.rb
fedux_org-stdlib-0.11.14 lib/fedux_org_stdlib/icon.rb