sai 0.3.1 → 0.4.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.
@@ -11,11 +11,10 @@ module Sai
11
11
  # @note For each named color, two methods are dynamically generated:
12
12
  # * color_name - Applies the color to the foreground
13
13
  # * on_color_name - Applies the color to the backgroundAll color methods return {Decorator}
14
- # @see Sai::NamedColors Sai::NamedColors for available color names
15
14
  #
16
15
  # @example Using a named color
17
- # decorator.azure.decorate('Hello') #=> "\e[38;2;0;127;255mHello\e[0m"
18
- # decorator.on_azure.decorate('Hello') #=> "\e[48;2;0;127;255mHello\e[0m"
16
+ # decorator.blue.decorate('Hello').to_s #=> "\e[38;2;0;0;238mHello\e[0m"
17
+ # decorator.on_blue.decorate('Hello').to_s #=> "\e[48;2;0;0;238mHello\e[0m"
19
18
  class Decorator
20
19
  include ColorManipulations
21
20
 
@@ -0,0 +1,106 @@
1
+ # Generated from lib/sai/registry.rb with RBS::Inline
2
+
3
+ module Sai
4
+ # The named color registry
5
+ #
6
+ # @author {https://aaronmallen.me Aaron Allen}
7
+ # @since 0.4.0
8
+ #
9
+ # @api private
10
+ module Registry
11
+ # Look up an RGB value by color name
12
+ #
13
+ # @author {https://aaronmallen.me Aaron Allen}
14
+ # @since 0.3.1
15
+ #
16
+ # @api private
17
+ #
18
+ # @param name [String, Symbol] the color name
19
+ #
20
+ # @return [Array<Integer>] the RGB value
21
+ # @rbs (String | Symbol name) -> Array[Integer]?
22
+ def self.[]: (String | Symbol name) -> Array[Integer]?
23
+
24
+ # Get a list of all color names
25
+ #
26
+ # @author {https://aaronmallen.me Aaron Allen}
27
+ # @since 0.3.1
28
+ #
29
+ # @api private
30
+ #
31
+ # @return [Array<Symbol>] the color names
32
+ def self.names: () -> untyped
33
+
34
+ # Register a named color with an RGB or Hexadecimal value
35
+ #
36
+ # @author {https://aaronmallen.me Aaron Allen}
37
+ # @since 0.4.0
38
+ #
39
+ # @api private
40
+ #
41
+ # @param name [String, Symbol] the name of the color being registered
42
+ # @param rgb_or_hex [Array<Integer>, String] the RGB or Hexadecimal value of the color
43
+ #
44
+ # @return [Boolean] `true` if the color was registered
45
+ # @rbs (String | Symbol name, Array[Integer] | String rgb_or_hex) -> void
46
+ def self.register: (String | Symbol name, Array[Integer] | String rgb_or_hex) -> void
47
+
48
+ # Subscribe to registry changes
49
+ #
50
+ # @author {https://aaronmallen.me Aaron Allen}
51
+ # @since 0.4.0
52
+ #
53
+ # @api private
54
+ #
55
+ # @param subscriber [Object] the subscriber
56
+ #
57
+ # @return [void]
58
+ # @rbs (Object subscriber) -> void
59
+ def self.subscribe: (Object subscriber) -> void
60
+
61
+ # Broadcast a color registration to all subscribers
62
+ #
63
+ # @author {https://aaronmallen.me Aaron Allen}
64
+ # @since 0.4.0
65
+ #
66
+ # @api private
67
+ #
68
+ # @param color_name [Symbol] the color name
69
+ #
70
+ # @return [void]
71
+ # @rbs (Symbol name) -> void
72
+ private def self.broadcast_registration: (Symbol name) -> void
73
+
74
+ # The Sai named colors lookup
75
+ #
76
+ # @author {https://aaronmallen.me Aaron Allen}
77
+ # @since 0.4.0
78
+ #
79
+ # @api private
80
+ #
81
+ # @return [Hash{Symbol => Array<Integer>}] the named colors lookup
82
+ private def self.lookup: () -> untyped
83
+
84
+ # The registry subscribers
85
+ #
86
+ # @author {https://aaronmallen.me Aaron Allen}
87
+ # @since 0.4.0
88
+ #
89
+ # @api private
90
+ #
91
+ # @return [Array<Class, Module, Object>] the subscribers
92
+ # @rbs () -> Array[Class | Module | Object]
93
+ private def self.subscribers: () -> Array[Class | Module | Object]
94
+
95
+ # A Mutex for thread safety
96
+ #
97
+ # @author {https://aaronmallen.me Aaron Allen}
98
+ # @since 0.4.0
99
+ #
100
+ # @api private
101
+ #
102
+ # @return [Mutex] the thread lock
103
+ # @rbs () -> Mutex
104
+ private def self.thread_lock: () -> Mutex
105
+ end
106
+ end