Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LM3/4 - Add gradients mechanic to tiered-coloring: #452

Open
UltimaOath opened this issue Apr 25, 2023 · 0 comments
Open

LM3/4 - Add gradients mechanic to tiered-coloring: #452

UltimaOath opened this issue Apr 25, 2023 · 0 comments

Comments

@UltimaOath
Copy link
Collaborator

The original concept from Discord:
https://discord.com/channels/752310043214479462/756850940694495253/1054205303073288232

Had another 'new feature' idea: Automatic Color Gradients for tiered-coloring: System
Using this system or similar:
https://stackoverflow.com/a/8732626

Idea being user sets two ends of a color gradient, and then LM selects the color on the spectrum which corresponds to a percentage of that gradient, based on the entities' level.

  apply-settings:
    tiered-coloring:
      1-5: ['&#79BE94', '&#22E76B'] #Light to Default Green
      6-10: ['&#7AD7BE', '&#528CFF'] #Light to Default Blue
      11-15: ['&#E0EEAC', '&#FFCD56'] #Light to Default Yellow
      16-20: ['&#CA575A', '&#F2003D'] #Light to Default Red
      21-25: ['&#B447FF', '&#4F3F75'] #Default Purple to Dark
      default: ['&#FFFFFF'] #White

Where if you're looking at the function in stackoverflow, color1 would be the first listed, and color2 would be the second listed. As for percent, that would be calculated by determining the number of levels in the range compared to the entities' level.

For example, in the first set of tiers I have levels 1-5 being set with a gradient between color1 and color2.
For Levels 1 and 5, those are set to the front and end caps; for the remaining levels, those would need to be a percentage of the gradient to receive their colors.
The formula would be percentage = ( entity_level / ( number_in_range - 1 ) )
number_in_range = the number of possible levels in the range, so 1-5 means levels 1, 2, 3, 4, and 5 so 5

Finally if entity_level is the same as the first number in range, it's handled as 0% rather than processed in formula

For Level 1, automatically set to 0% to set as color1
For Level 2, that is 1/4 = 25%
For Level 3, that is 2/4 = 50%
For Level 4, that is 3/4 = 75%
For Level 5, that is 4/4 = 100% or default color2

Then for further example in the next tier, 6-10, it would look like:
For Level 6, automatically set to 0% to set as color1
For Level 7, that is 1/4 = 25%
For Level 8, that is 2/4 = 50%
etc.


Lokka made mention of:
Gradients are already possible in LM4 as MineDown supports MiniMessage syntax

While this may be suitable my general idea is for the %tiered% value to be updated based on the current gradient value between the two selected colors, which is why I considered the percentage mechanism combined with some stackoverflow info regarding how to convert that percentage and the colors into a new hex color.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant