mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 08:08:43 +00:00
LibWeb: Interpolate legacy colors in sRGB
This commit is contained in:
parent
c18314b942
commit
1b7323fc2d
Notes:
github-actions[bot]
2025-07-04 14:29:15 +00:00
Author: https://github.com/Gingeh
Commit: 1b7323fc2d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5285
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/tcl3 ✅
8 changed files with 137 additions and 113 deletions
|
@ -177,13 +177,13 @@ ColorMixStyleValue::PercentageNormalizationResult ColorMixStyleValue::normalize_
|
|||
// https://drafts.csswg.org/css-color-5/#color-mix-result
|
||||
Color ColorMixStyleValue::to_color(Optional<Layout::NodeWithStyle const&> node, CalculationResolutionContext const& resolution_context) const
|
||||
{
|
||||
// FIXME: Do this in a spec-compliant way.
|
||||
// Our color interpolation doesn't currently take the color space or hue interpolation method into account.
|
||||
// FIXME: Take the color space and hue interpolation method into account.
|
||||
// The current implementation only uses oklab interpolation.
|
||||
auto normalized_percentages = normalize_percentages();
|
||||
auto from_color = m_properties.first_component.color->to_color(node, resolution_context);
|
||||
auto to_color = m_properties.second_component.color->to_color(node, resolution_context);
|
||||
auto from_color = m_properties.first_component.color;
|
||||
auto to_color = m_properties.second_component.color;
|
||||
auto delta = normalized_percentages.p2.value() / 100;
|
||||
return interpolate_color(from_color, to_color, delta);
|
||||
return interpolate_color(from_color->to_color(node, resolution_context), to_color->to_color(node, resolution_context), delta, ColorSyntax::Modern);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue