Class: Uniword::Shading
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Uniword::Shading
- Defined in:
- lib/uniword/shading.rb
Overview
Represents shading/background pattern for text or paragraphs
Shading provides background colors and patterns for text runs or paragraph backgrounds.
Constant Summary collapse
- TYPES =
Shading pattern types
%w[ clear solid horzStripe vertStripe reverseDiagStripe diagStripe horzCross diagCross thinHorzStripe thinVertStripe thinReverseDiagStripe thinDiagStripe thinHorzCross thinDiagCross pct5 pct10 pct12 pct15 pct20 pct25 pct30 pct35 pct37 pct40 pct45 pct50 pct55 pct60 pct62 pct65 pct70 pct75 pct80 pct85 pct87 pct90 pct95 ].freeze
Instance Attribute Summary collapse
-
#color ⇒ String
Foreground color (for patterns).
-
#fill ⇒ String
Background fill color.
-
#type ⇒ String
Shading pattern type.
Class Method Summary collapse
-
.diagonal_stripe(color: "000000", fill: "FFFFFF") ⇒ Shading
Create diagonal stripe pattern.
-
.horizontal_stripe(color: "000000", fill: "FFFFFF") ⇒ Shading
Create horizontal stripe pattern.
-
.pattern(type, color: "auto", fill: nil) ⇒ Shading
Create pattern shading.
-
.reverse_diagonal_stripe(color: "000000", fill: "FFFFFF") ⇒ Shading
Create reverse diagonal stripe pattern.
-
.solid(fill) ⇒ Shading
Create solid shading with fill color.
-
.vertical_stripe(color: "000000", fill: "FFFFFF") ⇒ Shading
Create vertical stripe pattern.
Instance Method Summary collapse
-
#initialize(**attributes) ⇒ Shading
constructor
A new instance of Shading.
Constructor Details
#initialize(**attributes) ⇒ Shading
Returns a new instance of Shading.
42 43 44 45 |
# File 'lib/uniword/shading.rb', line 42 def initialize(**attributes) super validate_type end |
Instance Attribute Details
#color ⇒ String
Foreground color (for patterns)
24 25 26 |
# File 'lib/uniword/shading.rb', line 24 def color @color end |
#fill ⇒ String
Background fill color
24 25 26 |
# File 'lib/uniword/shading.rb', line 24 def fill @fill end |
#type ⇒ String
Shading pattern type
24 25 26 |
# File 'lib/uniword/shading.rb', line 24 def type @type end |
Class Method Details
.diagonal_stripe(color: "000000", fill: "FFFFFF") ⇒ Shading
Create diagonal stripe pattern
88 89 90 |
# File 'lib/uniword/shading.rb', line 88 def self.diagonal_stripe(color: "000000", fill: "FFFFFF") new(type: "diagStripe", color: color, fill: fill) end |
.horizontal_stripe(color: "000000", fill: "FFFFFF") ⇒ Shading
Create horizontal stripe pattern
70 71 72 |
# File 'lib/uniword/shading.rb', line 70 def self.horizontal_stripe(color: "000000", fill: "FFFFFF") new(type: "horzStripe", color: color, fill: fill) end |
.pattern(type, color: "auto", fill: nil) ⇒ Shading
Create pattern shading
61 62 63 |
# File 'lib/uniword/shading.rb', line 61 def self.pattern(type, color: "auto", fill: nil) new(type: type, color: color, fill: fill) end |
.reverse_diagonal_stripe(color: "000000", fill: "FFFFFF") ⇒ Shading
Create reverse diagonal stripe pattern
97 98 99 |
# File 'lib/uniword/shading.rb', line 97 def self.reverse_diagonal_stripe(color: "000000", fill: "FFFFFF") new(type: "reverseDiagStripe", color: color, fill: fill) end |
.solid(fill) ⇒ Shading
Create solid shading with fill color
51 52 53 |
# File 'lib/uniword/shading.rb', line 51 def self.solid(fill) new(type: "clear", fill: fill) end |
.vertical_stripe(color: "000000", fill: "FFFFFF") ⇒ Shading
Create vertical stripe pattern
79 80 81 |
# File 'lib/uniword/shading.rb', line 79 def self.vertical_stripe(color: "000000", fill: "FFFFFF") new(type: "vertStripe", color: color, fill: fill) end |