colorato 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b28fd8267ee3efc81eeff84c4d0cb31904898b0c97f52277966e720f2e739ffd
4
- data.tar.gz: 2d096f6c8970cebea52a1e30fba7bd4fab9d5d85741c1968caed17cc0941d060
3
+ metadata.gz: bad7d3caff47acf5a90642ad8fdf76cd2f31a1a5b638e87784d844dcdfcd52f0
4
+ data.tar.gz: 888331e557f8ce33b6671945d0df95a8933403c792ae6d473c480ae3fe06917c
5
5
  SHA512:
6
- metadata.gz: '08c68f4329d2d36927ccfe3d02805ef8f21bde89f0ddb70a71b935454f8b2fcbe6557098d3ded29b2e38664a9307849f5fd9978fe2227867fafa2792ff1c6d75'
7
- data.tar.gz: 8cc6529dd0968df22087e816cc6a78b8b6ca4a6a109455b2401e7bf85273072b820b6979af0497aabb8c927b4298dd757a2bc2d4f3f5bb2f3c5f71535bbf210e
6
+ metadata.gz: 4ceade3164671b98971fa803e45235ff63fb2fe94c65d842cccc270975e6127f02070324f548eafb2a3840df3d7d835e19992e155bd8a39694442ac83d9cb243
7
+ data.tar.gz: b28e0e7d7045e2efaffe119eb1ac67aeb90e592c798aadaeb584a3c2eaf2cd5be8e4594551ceb6d739ff5db21e432753c9237cbd073e0f1c7853bb12f662bee0
data/CHANGELOG.md CHANGED
@@ -2,9 +2,15 @@
2
2
  # colorato
3
3
 
4
4
 
5
+ ## 1.2.0 released 2026-10-18
6
+
7
+ * Introduce Colorato .colour_if_tty and .colour_if_supported
8
+ * Sort colour names in .show_colours
9
+
10
+
5
11
  ## 1.1.0 released 2025-01-16
6
12
 
7
- * colorato.blue { 'blo' + 'ck' }
13
+ * Colorato.blue { 'blo' + 'ck' }
8
14
  * Show the colours when `ruby lib/colorato.rb`
9
15
 
10
16
 
data/LICENSE.txt CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- Copyright (c) 2015-2025, John Mettraux, jmettraux+flor@gmail.com
2
+ Copyright (c) 2015-2026, John Mettraux, jmettraux+flor@gmail.com
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  of this software and associated documentation files (the "Software"), to deal
data/lib/colorato/core.rb CHANGED
@@ -70,6 +70,36 @@ module Colorato
70
70
  alias nocolors no_colours
71
71
  alias no_colors no_colours
72
72
 
73
+ def colour_if_tty(out=$stdout)
74
+
75
+ return (out.tty? rescue false) ? colours : no_colours
76
+ end
77
+ alias color_if_tty colour_if_tty
78
+
79
+ def colour_if_supported(out=$stdout)
80
+
81
+ return no_colours unless out.tty?
82
+
83
+ return no_colours if ENV['NO_COLOR']
84
+
85
+ return no_colours if ENV['FORCE_COLOR'] || ENV['FORCE_COLOUR']
86
+ # colorato...
87
+
88
+ return colours if ENV['COLORTERM']
89
+
90
+ t = ENV['TERM']
91
+
92
+ return colours if t == nil
93
+ return no_colours if t == 'dumb'
94
+
95
+ #return colours if t == 'screen'
96
+ #return colours if t.include?('color')
97
+ #return colours if t.include?('xterm')
98
+
99
+ colours
100
+ end
101
+ alias color_if_supported colour_if_supported
102
+
73
103
  def show_colours
74
104
 
75
105
  cs = Colorato.colours.public_methods
@@ -77,6 +107,7 @@ module Colorato
77
107
  m = n.to_s.match(/^bg_(.+)$/)
78
108
  a << m[1] if m
79
109
  a }
110
+ .sort
80
111
 
81
112
  #%w[ (default) bright dim ].each do |filter|
82
113
 
data/lib/colorato/more.rb CHANGED
@@ -55,4 +55,3 @@ module Colorato; class << self
55
55
  alias nocolour_length no_colour_length
56
56
  end; end
57
57
 
58
-
data/lib/colorato.rb CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Colorato
5
5
 
6
- VERSION = '1.1.0'
6
+ VERSION = '1.2.0'
7
7
  end
8
8
 
9
9
  require 'colorato/core'
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colorato
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-01-16 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: probatio
@@ -49,7 +48,6 @@ metadata:
49
48
  homepage_uri: https://github.com/floraison/colorato
50
49
  source_code_uri: https://github.com/floraison/colorato
51
50
  rubygems_mfa_required: 'true'
52
- post_install_message:
53
51
  rdoc_options: []
54
52
  require_paths:
55
53
  - lib
@@ -64,8 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
62
  - !ruby/object:Gem::Version
65
63
  version: '0'
66
64
  requirements: []
67
- rubygems_version: 3.5.16
68
- signing_key:
65
+ rubygems_version: 3.6.9
69
66
  specification_version: 4
70
67
  summary: terminal colors for flor
71
68
  test_files: []