Sha256: f7269a1a73274c804dabd2529ab30ca1fc8cf9f408c0690fd3e09272a2c5b393

Contents?: true

Size: 842 Bytes

Versions: 5

Compression:

Stored size: 842 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, :uri_image, :to_data_uri

    @patterns = %w(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

5 entries across 5 versions & 1 rubygems

Version Path
fedux_org-stdlib-0.11.12 lib/fedux_org_stdlib/icon.rb
fedux_org-stdlib-0.11.11 lib/fedux_org_stdlib/icon.rb
fedux_org-stdlib-0.11.9 lib/fedux_org_stdlib/icon.rb
fedux_org-stdlib-0.11.8 lib/fedux_org_stdlib/icon.rb
fedux_org-stdlib-0.11.7 lib/fedux_org_stdlib/icon.rb