Skip to content

Commit

Permalink
ColorThief improvements
Browse files Browse the repository at this point in the history
- [Perf] Avoid multiple enumerations
- CodeQA and removing some unused methods
- Revert the color matrix to BT709
- Reduce saturation from 1.5 to 1.2
  • Loading branch information
neon-nyan committed Oct 26, 2024
1 parent f83ecdc commit d3647c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ private static async Task<WColor> GetPaletteList(BitmapInputStruct bitmapInput,
{
LumaUtils.DarkThreshold = isLight ? 200f : 400f;
LumaUtils.IgnoreWhiteThreshold = isLight ? 900f : 800f;
LumaUtils.ChangeCoeToBT601();
// LumaUtils.ChangeCoeToBT601();

QuantizedColor averageColor = await Task.Run(() =>
ColorThief.GetColor(bitmapInput.Buffer,
Expand All @@ -219,7 +219,7 @@ private static async Task<WColor> GetPaletteList(BitmapInputStruct bitmapInput,
;

WColor wColor = DrawingColorToColor(averageColor);
WColor adjustedColor = wColor.SetSaturation(1.5);
WColor adjustedColor = wColor.SetSaturation(1.2);
adjustedColor = isLight ? adjustedColor.GetDarkColor() : adjustedColor.GetLightColor();

return adjustedColor;
Expand Down
2 changes: 1 addition & 1 deletion ColorThief

0 comments on commit d3647c7

Please sign in to comment.