Skip to content

Conversation

@ScarletKuro
Copy link
Member

@ScarletKuro ScarletKuro commented Nov 23, 2024

Description

Since we already have the Lerp algorithm (#10275) and MudColor implements HSL information, ColorLighten, and ColorDarken, I thought it would make sense to add palette algorithms.
NB!: These algorithms are very simple, generic and most common ones. They do not allocate any additional memory, as I only use IEnumerable and yield return.

I replaced the statically generated palette in ColorPickerPaletteExample with our algorithms:

palette

  • The first line shows the tint palette.
  • The second line shows the shades palette.
  • The third line shows both the tint and shades palettes at the same time (reverted sequence).
  • The fourth line shows the analogous palette.
  • The fifth line shows the gradient palette between two colors.
  • The sixth line shows the multi gradient between three(it can be more) colors. (new: added in MudColor: Add GenerateMultiGradientPalette #10318)

How Has This Been Tested?

Unit tests added, visually

Type of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or improvement to the website or code docs)

Checklist

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

@github-actions github-actions bot added enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library PR: needs review labels Nov 23, 2024
@codecov
Copy link

codecov bot commented Nov 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.54%. Comparing base (e7cea92) to head (7d232eb).
Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev   #10313   +/-   ##
=======================================
  Coverage   91.54%   91.54%           
=======================================
  Files         414      415    +1     
  Lines       13016    13017    +1     
  Branches     2457     2457           
=======================================
+ Hits        11916    11917    +1     
  Misses        549      549           
  Partials      551      551           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@ScarletKuro
Copy link
Member Author

ScarletKuro commented Nov 23, 2024

@henon @danielchalmers just tagging you both to let you know that this exists now.
@versile2, maybe you could use something from this, but as I mentioned in #10263 (comment), you have something more custom. Upd for my response, with GenerateMultiGradientPalette you can actually replace half of code.

@ScarletKuro ScarletKuro merged commit bc12e45 into MudBlazor:dev Nov 23, 2024
5 checks passed
@ScarletKuro ScarletKuro deleted the palette branch November 23, 2024 22:05
LLauter pushed a commit to cannellamedia/MudBlazor that referenced this pull request Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant