Skip to content

Commit

Permalink
Support missing channels across the embedded protocol (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme authored Oct 12, 2024
1 parent 60def2e commit d25744e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions lib/sass/compiler/host/protofier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,14 @@ def from_proto(proto)
when :number
Number.from_proto(obj)
when :color
obj.to_s # TODO: https://github.com/protocolbuffers/protobuf/issues/18807
Sass::Value::Color.send(
:for_space,
obj.space,
obj.channel1,
obj.channel2,
obj.channel3,
obj.alpha
obj.has_channel1? ? obj.channel1 : nil,
obj.has_channel2? ? obj.channel2 : nil,
obj.has_channel3? ? obj.channel3 : nil,
obj.has_alpha? ? obj.alpha : nil
)
when :argument_list
Sass::Value::ArgumentList.new(
Expand Down
6 changes: 3 additions & 3 deletions spec/sass_proto_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def remote_eq(lhs, rhs)
])
]),
__LINE__ => Sass::Value::Calculation.clamp(Sass::Value::String.new('var(--clamp)', quoted: false)),
__LINE__ => Sass::Value::Color.new(red: 0, green: 0, blue: 0, alpha: 1),
__LINE__ => Sass::Value::Color.new(hue: 0, saturation: 0, lightness: 0, alpha: 1),
__LINE__ => Sass::Value::Color.new(hue: 0, whiteness: 0, blackness: 0, alpha: 1),
__LINE__ => Sass::Value::Color.new(red: 0.1, green: 0.2, blue: nil, alpha: 1, space: 'rgb'),
__LINE__ => Sass::Value::Color.new(hue: 0.4, saturation: nil, lightness: 0.6, alpha: 1, space: 'hsl'),
__LINE__ => Sass::Value::Color.new(hue: nil, whiteness: 0.8, blackness: 0.9, alpha: 1, space: 'hwb'),
__LINE__ => Sass::Value::List.new,
__LINE__ => Sass::Value::List.new([Sass::Value::String.new('a')]),
__LINE__ => Sass::Value::List.new([Sass::Value::String.new('a')], separator: ','),
Expand Down

0 comments on commit d25744e

Please sign in to comment.