MCPcopy Create free account
hub / github.com/csskit/csskit / resolve_alpha

Function resolve_alpha

crates/css_ast/src/functions/relative_color.rs:746–753  ·  view source on GitHub ↗
(v: &RelativeChannelValue<K>, origin: &O)

Source from the content-addressed store, hash-verified

744 }
745
746 fn resolve_alpha<K, O: ChannelMap<K>>(v: &RelativeChannelValue<K>, origin: &O) -> Option<f32> {
747 match v {
748 RelativeChannelValue::Keyword(kw) => Some(origin.channel(kw)),
749 RelativeChannelValue::Value(NoneOr::None(_)) => None,
750 RelativeChannelValue::Value(NoneOr::Some(NumberOrPercentage::Number(n))) => Some(n.value() * 100.0),
751 RelativeChannelValue::Value(NoneOr::Some(NumberOrPercentage::Percentage(p))) => Some(p.value()),
752 }
753 }
754
755 fn resolve_hue_channel<K, O: ChannelMap<K>>(v: &RelativeHueValue<K>, origin: &O) -> Option<f32> {
756 match v {

Callers 3

to_chromashiftMethod · 0.85

Calls 2

channelMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected