stylegen 0.5.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31f78139e4e4008bf37ab9d48bc8e00309b7a04d98be8e0a2d66a281afde0780
4
- data.tar.gz: e08e613e70ef4ca0f96989051db35496783caf8c4de3245fb78600d6a72cd15a
3
+ metadata.gz: 1111eac2ab1e78ddbbf145cd5e312055987fb2c5cb9d8583bfb285bed59ed0fd
4
+ data.tar.gz: 1d52bbd99656c48c30283e92f027c762c4a2bb7a9dea97f6b9011cf1697d0c90
5
5
  SHA512:
6
- metadata.gz: aa6e4794fb3fa16e907aa5fe272fce946b225de69565ca92dee659dd2ddaae63e6ae141c320366bb05ff8dade91ae5b3acd1cb8ca5f0641ab44cfa909971a4bc
7
- data.tar.gz: d0b5c306bb2edc0e1c017ba35df7dfb6445d02fe66b12cc7560999461c7ce4a2549378a47b371466b49771cb7300fb360a50ca6345f62e48c23137d1a58644d2
6
+ metadata.gz: 1644652ac415fd8c664d212fb6e5124f343534db30ab826e90393ba021b8ee1b6adf41553a05e0f1a85fc26fc577fa32ff3378e7d8fe4daa5027bf3f53f9d490
7
+ data.tar.gz: bd3b5852200b345aa27c654c37f7d2ff93d22bede05b36ca2952769f51466fb759efaa00acecf26ca8fbe83cc9c6665828b38440a29b2376527bd0e82137d496
data/CHANGELOG.md CHANGED
@@ -1,6 +1,17 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## v0.6.1
5
+ ### Fixed
6
+ - Fixed a bug where an extra space was being added after the access-level modifier in the generated code.
7
+
8
+ ## v0.6.0
9
+ ### Changed
10
+ - Switched from GLI to dry-cli for CLI. Some may produce slightly different STDOUT and STDERR output.
11
+ ### Added
12
+ - Added `--output` flag to `stylegen init` command. This allows you to specify a different output file than the default `theme.yaml`.
13
+ - Added `--input` flag to `stylegen build` command. This allows you to specify a different input file than the default `theme.yaml`.
14
+
4
15
  ## v0.5.0
5
16
  ### Changed
6
17
  - Switched generated code from `struct` to `class`.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2021 Ramon Torres
1
+ Copyright (c) 2021-2023 Ramon Torres
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
data/bin/stylegen CHANGED
@@ -1,6 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'stylegen/cli'
4
+ require 'stylegen'
5
5
 
6
- exit Stylegen::CLI::App.run(ARGV)
6
+ begin
7
+ arguments = ARGV.empty? ? ['build'] : ARGV
8
+ cli = Dry::CLI.new(Stylegen::CLI::Commands)
9
+ cli.call(arguments: arguments)
10
+ rescue Stylegen::CLI::Commands::Error => e
11
+ warn e.message
12
+ exit 1
13
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaml'
4
+ require 'dry/cli'
5
+
6
+ require 'stylegen/validator'
7
+ require 'stylegen/generator'
8
+ require 'stylegen/version'
9
+ require 'stylegen/cli/error'
10
+
11
+ module Stylegen
12
+ module CLI
13
+ module Commands
14
+ extend Dry::CLI::Registry
15
+
16
+ class Error < StandardError
17
+ end
18
+
19
+ class Version < Dry::CLI::Command
20
+ desc 'Prints stylegen version'
21
+
22
+ def call(*)
23
+ puts "stylegen version #{Stylegen::VERSION}"
24
+ end
25
+ end
26
+
27
+ class Init < Dry::CLI::Command
28
+ desc 'Generates a sample theme.yaml file in the current directory'
29
+
30
+ option :output, aliases: ['-o'], type: :string, default: 'theme.yaml', desc: 'Path to the output file'
31
+
32
+ def call(output: 'theme.yaml', **)
33
+ raise Error, "'#{output}' already exists." if File.exist?(output)
34
+
35
+ template = File.read(File.join(__dir__, 'template.yaml'))
36
+ File.write(output, template)
37
+
38
+ puts "Generated '#{output}'."
39
+ end
40
+ end
41
+
42
+ class Build < Dry::CLI::Command
43
+ desc 'Generates the Swift colors file'
44
+
45
+ option :input, aliases: ['-i'], type: :string, default: 'theme.yaml', desc: 'Path to the theme.yaml file'
46
+
47
+ def call(input: 'theme.yaml', **)
48
+ raise Error, "'#{input}' not found. Create one with 'stylegen init'." unless File.exist?(input)
49
+
50
+ data = File.open(input) { |file| YAML.safe_load(file) }
51
+
52
+ validator = Validator.new
53
+ unless validator.valid?(data)
54
+ message = []
55
+ message << "#{input} contains one or more errors:"
56
+
57
+ validator.validate(data).each do |e|
58
+ message << " #{e}"
59
+ end
60
+
61
+ raise Error, message.join("\n")
62
+ end
63
+
64
+ generator = Generator.new(data)
65
+ generator.generate
66
+
67
+ puts "Generated '#{generator.stats[:output_path]}' with #{generator.stats[:color_count]} colors."
68
+ end
69
+ end
70
+
71
+ register 'init', Init
72
+ register 'build', Build
73
+ register 'version', Version, aliases: ['-v', '--version']
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stylegen
4
+ module CLI
5
+ class Error < StandardError
6
+ end
7
+ end
8
+ end
data/lib/stylegen/cli.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'stylegen/cli/app'
3
+ require 'stylegen/cli/commands'
@@ -4,6 +4,8 @@ module Stylegen
4
4
  class Color
5
5
  attr_reader :red, :green, :blue, :alpha
6
6
 
7
+ SIX_DIGIT_HEX_REGEX = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/.freeze
8
+ THREE_DIGIT_HEX_REGEX = /^#?([a-f\d])([a-f\d])([a-f\d])$/.freeze
7
9
  MAX_PRECISION = 16
8
10
 
9
11
  def initialize(red, green, blue, alpha)
@@ -14,11 +16,11 @@ module Stylegen
14
16
  end
15
17
 
16
18
  def self.from_hex(hex, alpha = nil)
17
- if (match = hex.downcase.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/))
19
+ if (match = hex.downcase.match(SIX_DIGIT_HEX_REGEX))
18
20
  r = Integer(match.captures[0], 16) / 255.0
19
21
  g = Integer(match.captures[1], 16) / 255.0
20
22
  b = Integer(match.captures[2], 16) / 255.0
21
- elsif (match = hex.downcase.match(/^#?([a-f\d])([a-f\d])([a-f\d])$/))
23
+ elsif (match = hex.downcase.match(THREE_DIGIT_HEX_REGEX))
22
24
  r = Integer(match.captures[0] * 2, 16) / 255.0
23
25
  g = Integer(match.captures[1] * 2, 16) / 255.0
24
26
  b = Integer(match.captures[2] * 2, 16) / 255.0
data/lib/stylegen/data.rb CHANGED
@@ -62,7 +62,7 @@ module Stylegen
62
62
  end
63
63
 
64
64
  def effective_access_level
65
- access_level == 'internal' ? '' : "#{access_level} "
65
+ access_level == 'internal' ? '' : access_level
66
66
  end
67
67
 
68
68
  def struct_name
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stylegen
4
- VERSION = '0.5.0'
4
+ VERSION = '0.6.1'
5
5
  end
data/lib/stylegen.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'stylegen/version'
4
+ require 'stylegen/cli'
4
5
  require 'stylegen/colors'
5
6
  require 'stylegen/generator'
6
7
  require 'stylegen/data'
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stylegen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramon Torres
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-15 00:00:00.000000000 Z
11
+ date: 2023-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: dry-inflector
14
+ name: dry-cli
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.0
19
+ version: 0.7.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.2.0
26
+ version: 0.7.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: gli
28
+ name: dry-inflector
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.1'
33
+ version: 0.2.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.1'
40
+ version: 0.2.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: json_schemer
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -144,20 +144,14 @@ executables:
144
144
  extensions: []
145
145
  extra_rdoc_files: []
146
146
  files:
147
- - ".deepsource.toml"
148
- - ".github/workflows/ci.yml"
149
- - ".gitignore"
150
- - ".rubocop.yml"
151
147
  - CHANGELOG.md
152
- - Gemfile
153
- - Gemfile.lock
154
148
  - LICENSE
155
149
  - README.md
156
- - Rakefile
157
150
  - bin/stylegen
158
151
  - lib/stylegen.rb
159
152
  - lib/stylegen/cli.rb
160
- - lib/stylegen/cli/app.rb
153
+ - lib/stylegen/cli/commands.rb
154
+ - lib/stylegen/cli/error.rb
161
155
  - lib/stylegen/cli/template.yaml
162
156
  - lib/stylegen/colors.rb
163
157
  - lib/stylegen/colors/base_elevated_color.rb
@@ -169,15 +163,11 @@ files:
169
163
  - lib/stylegen/template.rb
170
164
  - lib/stylegen/validator.rb
171
165
  - lib/stylegen/version.rb
172
- - stylegen.gemspec
173
- - test/helper.rb
174
- - test/test_base_elevated_color.rb
175
- - test/test_color.rb
176
- - test/test_light_dark_color.rb
177
166
  homepage: https://github.com/raymondjavaxx/stylegen
178
167
  licenses:
179
168
  - MIT
180
- metadata: {}
169
+ metadata:
170
+ rubygems_mfa_required: 'true'
181
171
  post_install_message:
182
172
  rdoc_options: []
183
173
  require_paths:
@@ -193,12 +183,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
183
  - !ruby/object:Gem::Version
194
184
  version: '0'
195
185
  requirements: []
196
- rubygems_version: 3.1.2
186
+ rubygems_version: 3.1.4
197
187
  signing_key:
198
188
  specification_version: 4
199
189
  summary: Tool for generating styling code for iOS apps
200
- test_files:
201
- - test/helper.rb
202
- - test/test_base_elevated_color.rb
203
- - test/test_color.rb
204
- - test/test_light_dark_color.rb
190
+ test_files: []
data/.deepsource.toml DELETED
@@ -1,5 +0,0 @@
1
- version = 1
2
-
3
- [[analyzers]]
4
- name = "ruby"
5
- enabled = true
@@ -1,32 +0,0 @@
1
- name: CI
2
- on:
3
- push:
4
- branches:
5
- - master
6
- pull_request:
7
- branches:
8
- - master
9
-
10
- jobs:
11
- test:
12
- runs-on: ubuntu-latest
13
- strategy:
14
- matrix:
15
- ruby-version:
16
- - "2.5"
17
- - "2.6"
18
- - "2.7"
19
- - "3.0"
20
- - "3.1"
21
-
22
- steps:
23
- - uses: actions/checkout@v3
24
- - name: Set up Ruby
25
- uses: ruby/setup-ruby@v1
26
- with:
27
- ruby-version: ${{ matrix.ruby-version }}
28
- bundler-cache: true # runs 'bundle install' and caches installed gems automatically
29
- - name: Lint
30
- run: bundle exec rake rubocop
31
- - name: Run tests
32
- run: bundle exec rake
data/.gitignore DELETED
@@ -1,6 +0,0 @@
1
- .idea
2
- pkg
3
-
4
- # Testing artifacts
5
- theme.yaml
6
- Colors.swift
data/.rubocop.yml DELETED
@@ -1,16 +0,0 @@
1
- require:
2
- - rubocop-rake
3
- - rubocop-minitest
4
-
5
- AllCops:
6
- TargetRubyVersion: 2.5
7
- NewCops: enable
8
-
9
- Metrics/MethodLength:
10
- Enabled: false
11
-
12
- Metrics/AbcSize:
13
- Enabled: false
14
-
15
- Style/Documentation:
16
- Enabled: false
data/Gemfile DELETED
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gemspec
data/Gemfile.lock DELETED
@@ -1,63 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- stylegen (0.5.0)
5
- dry-inflector (~> 0.2.0)
6
- gli (~> 2.1)
7
- json_schemer (~> 0.2.0)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- ast (2.4.2)
13
- dry-inflector (0.2.0)
14
- ecma-re-validator (0.3.0)
15
- regexp_parser (~> 2.0)
16
- gli (2.21.0)
17
- hana (1.3.7)
18
- json_schemer (0.2.24)
19
- ecma-re-validator (~> 0.3)
20
- hana (~> 1.3)
21
- regexp_parser (~> 2.0)
22
- uri_template (~> 0.7)
23
- minitest (5.14.4)
24
- parallel (1.20.1)
25
- parser (3.0.1.1)
26
- ast (~> 2.4.1)
27
- rainbow (3.0.0)
28
- rake (13.0.3)
29
- regexp_parser (2.1.1)
30
- rexml (3.2.5)
31
- rubocop (1.14.0)
32
- parallel (~> 1.10)
33
- parser (>= 3.0.0.0)
34
- rainbow (>= 2.2.2, < 4.0)
35
- regexp_parser (>= 1.8, < 3.0)
36
- rexml
37
- rubocop-ast (>= 1.5.0, < 2.0)
38
- ruby-progressbar (~> 1.7)
39
- unicode-display_width (>= 1.4.0, < 3.0)
40
- rubocop-ast (1.5.0)
41
- parser (>= 3.0.1.1)
42
- rubocop-minitest (0.12.1)
43
- rubocop (>= 0.90, < 2.0)
44
- rubocop-rake (0.5.1)
45
- rubocop
46
- ruby-progressbar (1.11.0)
47
- unicode-display_width (2.0.0)
48
- uri_template (0.7.0)
49
-
50
- PLATFORMS
51
- ruby
52
-
53
- DEPENDENCIES
54
- bundler
55
- minitest (~> 5.14)
56
- rake
57
- rubocop
58
- rubocop-minitest
59
- rubocop-rake
60
- stylegen!
61
-
62
- BUNDLED WITH
63
- 2.1.4
data/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rake/testtask'
5
- require 'rubocop/rake_task'
6
-
7
- Rake::TestTask.new
8
- RuboCop::RakeTask.new
9
-
10
- task default: :test
@@ -1,62 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'yaml'
4
- require 'gli'
5
-
6
- require 'stylegen/validator'
7
- require 'stylegen/generator'
8
-
9
- module Stylegen
10
- module CLI
11
- class App
12
- extend GLI::App
13
-
14
- program_desc 'CLI tool for managing colors in iOS apps'
15
-
16
- version Stylegen::VERSION
17
-
18
- default_command :build
19
-
20
- # Commands
21
-
22
- desc 'Generates a sample theme.yaml file in the current directory'
23
- command :init do |c|
24
- c.action do
25
- exit_now!("'theme.yaml' already exists!") if File.exist?('theme.yaml')
26
-
27
- template = File.read(File.join(__dir__, 'template.yaml'))
28
- File.write('theme.yaml', template)
29
-
30
- puts "Generated 'theme.yaml'."
31
- end
32
- end
33
-
34
- desc 'Generates the Swift colors file'
35
- command :build do |c|
36
- c.action do
37
- exit_now!("'theme.yaml' not found. Create one with 'stylegen init'.") unless File.exist?('theme.yaml')
38
-
39
- data = File.open('theme.yaml') { |file| YAML.safe_load(file) }
40
-
41
- validator = Validator.new
42
-
43
- unless validator.valid?(data)
44
- message = []
45
- message << 'theme.yaml contains one or more errors:'
46
-
47
- validator.validate(data).each do |e|
48
- message << " #{e}"
49
- end
50
-
51
- exit_now!(message.join("\n"))
52
- end
53
-
54
- generator = Generator.new(data)
55
- generator.generate
56
-
57
- puts "Generated '#{generator.stats[:output_path]}' with #{generator.stats[:color_count]} colors."
58
- end
59
- end
60
- end
61
- end
62
- end
data/stylegen.gemspec DELETED
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require './lib/stylegen/version'
4
-
5
- Gem::Specification.new do |s|
6
- s.name = 'stylegen'
7
- s.version = Stylegen::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ['Ramon Torres']
10
- s.email = ['raymondjavaxx@gmail.com']
11
- s.homepage = 'https://github.com/raymondjavaxx/stylegen'
12
- s.description = s.summary = 'Tool for generating styling code for iOS apps'
13
- s.files = `git ls-files`.split("\n")
14
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
- s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
16
- s.require_paths = ['lib']
17
- s.license = 'MIT'
18
-
19
- s.add_runtime_dependency 'dry-inflector', '~> 0.2.0'
20
- s.add_runtime_dependency 'gli', '~> 2.1'
21
- s.add_runtime_dependency 'json_schemer', '~> 0.2.0'
22
-
23
- s.add_development_dependency 'bundler'
24
- s.add_development_dependency 'minitest', '~> 5.14'
25
- s.add_development_dependency 'rake'
26
- s.add_development_dependency 'rubocop'
27
- s.add_development_dependency 'rubocop-minitest'
28
- s.add_development_dependency 'rubocop-rake'
29
-
30
- s.required_ruby_version = '>= 2.5.0'
31
- end
data/test/helper.rb DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- gem 'minitest'
4
-
5
- require 'minitest/pride'
6
- require 'minitest/autorun'
7
-
8
- require_relative '../lib/stylegen'
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'helper'
4
-
5
- class TestBaseElevatedColor < MiniTest::Test
6
- def test_to_string
7
- color = Stylegen::BaseElevatedColor.new(
8
- Stylegen::Color.from_hex('#000000'),
9
- Stylegen::Color.from_hex('#333333')
10
- )
11
-
12
- # Default indentation
13
-
14
- expected = <<~CODE.chomp
15
- ThemeColor(
16
- base: ThemeColor(white: 0.0, alpha: 1.0),
17
- elevated: ThemeColor(white: 0.2, alpha: 1.0)
18
- )
19
- CODE
20
-
21
- assert_equal expected, color.to_s('ThemeColor')
22
-
23
- # Additional indentation
24
-
25
- expected = <<~CODE.chomp
26
- ThemeColor(
27
- base: ThemeColor(white: 0.0, alpha: 1.0),
28
- elevated: ThemeColor(white: 0.2, alpha: 1.0)
29
- )
30
- CODE
31
-
32
- assert_equal expected, color.to_s('ThemeColor', 4)
33
- end
34
- end
data/test/test_color.rb DELETED
@@ -1,67 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'helper'
4
-
5
- class TestColor < MiniTest::Test
6
- def test_parsing
7
- color = Stylegen::Color.from_hex('#FF8000')
8
- assert_in_delta(1.0, color.red)
9
- assert_in_delta(0.5019607843137255, color.green)
10
- assert_in_delta(0.0, color.blue)
11
- assert_in_delta(1.0, color.alpha)
12
-
13
- # Optional pound sign
14
- color = Stylegen::Color.from_hex('FF8000')
15
- assert_in_delta(1.0, color.red)
16
- assert_in_delta(0.5019607843137255, color.green)
17
- assert_in_delta(0.0, color.blue)
18
- assert_in_delta(1.0, color.alpha)
19
-
20
- # Specify alpha
21
- color = Stylegen::Color.from_hex('#FF8000', 0.5)
22
- assert_in_delta(0.5, color.alpha)
23
- end
24
-
25
- def test_parsing_shorthand_syntax
26
- color = Stylegen::Color.from_hex('#FC0')
27
- assert_in_delta(1.0, color.red)
28
- assert_in_delta(0.8000000000000002, color.green)
29
- assert_in_delta(0.0, color.blue)
30
- assert_in_delta(1.0, color.alpha)
31
-
32
- # Optional pound sign
33
- color = Stylegen::Color.from_hex('FC0')
34
- assert_in_delta(1.0, color.red)
35
- assert_in_delta(0.8000000000000002, color.green)
36
- assert_in_delta(0.0, color.blue)
37
- assert_in_delta(1.0, color.alpha)
38
- end
39
-
40
- def test_grayscale
41
- color = Stylegen::Color.new(1, 1, 1, 1)
42
- assert color.grayscale?
43
-
44
- color = Stylegen::Color.new(1, 1, 0.9, 1)
45
- refute color.grayscale?
46
- end
47
-
48
- def test_to_string
49
- color = Stylegen::Color.from_hex('#00FF00')
50
-
51
- expected = <<~CODE.strip
52
- ThemeColor(
53
- red: 0.0,
54
- green: 1.0,
55
- blue: 0.0,
56
- alpha: 1.0
57
- )
58
- CODE
59
-
60
- assert_equal expected, color.to_s('ThemeColor')
61
-
62
- # Grayscale
63
- color = Stylegen::Color.from_hex('#FFFFFF')
64
- expected = 'ThemeColor(white: 1.0, alpha: 1.0)'
65
- assert_equal expected, color.to_s('ThemeColor')
66
- end
67
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'helper'
4
-
5
- class TestLightDarkColor < MiniTest::Test
6
- def test_to_string
7
- color = Stylegen::LightDarkColor.new(
8
- Stylegen::Color.from_hex('#FFFFFF'),
9
- Stylegen::Color.from_hex('#333333')
10
- )
11
-
12
- # Default indentation
13
-
14
- expected = <<~CODE.chomp
15
- ThemeColor(
16
- light: ThemeColor(white: 1.0, alpha: 1.0),
17
- dark: ThemeColor(white: 0.2, alpha: 1.0)
18
- )
19
- CODE
20
-
21
- assert_equal expected, color.to_s('ThemeColor')
22
-
23
- # Additional indentation
24
-
25
- expected = <<~CODE.chomp
26
- ThemeColor(
27
- light: ThemeColor(white: 1.0, alpha: 1.0),
28
- dark: ThemeColor(white: 0.2, alpha: 1.0)
29
- )
30
- CODE
31
-
32
- assert_equal expected, color.to_s('ThemeColor', 4)
33
- end
34
- end