Skip to content

Commit d25744e

Browse files
authored
Support missing channels across the embedded protocol (#246)
1 parent 60def2e commit d25744e

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

lib/sass/compiler/host/protofier.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,14 @@ def from_proto(proto)
112112
when :number
113113
Number.from_proto(obj)
114114
when :color
115+
obj.to_s # TODO: https://github.com/protocolbuffers/protobuf/issues/18807
115116
Sass::Value::Color.send(
116117
:for_space,
117118
obj.space,
118-
obj.channel1,
119-
obj.channel2,
120-
obj.channel3,
121-
obj.alpha
119+
obj.has_channel1? ? obj.channel1 : nil,
120+
obj.has_channel2? ? obj.channel2 : nil,
121+
obj.has_channel3? ? obj.channel3 : nil,
122+
obj.has_alpha? ? obj.alpha : nil
122123
)
123124
when :argument_list
124125
Sass::Value::ArgumentList.new(

spec/sass_proto_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ def remote_eq(lhs, rhs)
6363
])
6464
]),
6565
__LINE__ => Sass::Value::Calculation.clamp(Sass::Value::String.new('var(--clamp)', quoted: false)),
66-
__LINE__ => Sass::Value::Color.new(red: 0, green: 0, blue: 0, alpha: 1),
67-
__LINE__ => Sass::Value::Color.new(hue: 0, saturation: 0, lightness: 0, alpha: 1),
68-
__LINE__ => Sass::Value::Color.new(hue: 0, whiteness: 0, blackness: 0, alpha: 1),
66+
__LINE__ => Sass::Value::Color.new(red: 0.1, green: 0.2, blue: nil, alpha: 1, space: 'rgb'),
67+
__LINE__ => Sass::Value::Color.new(hue: 0.4, saturation: nil, lightness: 0.6, alpha: 1, space: 'hsl'),
68+
__LINE__ => Sass::Value::Color.new(hue: nil, whiteness: 0.8, blackness: 0.9, alpha: 1, space: 'hwb'),
6969
__LINE__ => Sass::Value::List.new,
7070
__LINE__ => Sass::Value::List.new([Sass::Value::String.new('a')]),
7171
__LINE__ => Sass::Value::List.new([Sass::Value::String.new('a')], separator: ','),

0 commit comments

Comments
 (0)