Expand description
This is a library for calculating the ideal combination of glass colors to color a Minecraft beacon.
§Features
- Color Approxmation: Find the best combination of glass colors to approximate a given color
- Pane Calculation: Calculate the color of the beacon beam with some given glass colors
- Standard Colors: Acces the standard Minecraft colors
§Color Approxmation
find_combination_default
and it’s custom variants are used for approximating a color using
the limited palette of Minecraft colors.
use beacon_calculator::find_combination_default;
find_combination_default([254, 44, 84]);
Returns:
Some(Panes {
panes: [
"pink",
"magenta",
"orange",
"pink",
"pink",
"red",
],
distance: 7.9557647705078125,
color: PreciseRGB {
red: 208.5,
green: 89.90625,
blue: 95.78125,
},
})
§Performance Considerations
When using the custom variants pay attention to what limits you set, as they can get out of
hand rather quickly. A depth
and cutoff
of 7 already take longer than 30 seconds on my
machine for example. The accuracy doesn’t get much better with values over 6 anyway.
§Get color from panes
calculate_color_from_panes_default
and it’s custom counterpart are used for getting the color
of a Vec<String>
representing a list of glass colors. Order is important here!
use beacon_calculator::calculate_color_from_panes_default;
calculate_color_from_panes_default(&[
"red".to_string(),
"green".to_string(),
"red".to_string(),
]);
Returns:
PreciseRGB {
red: 155.5,
green: 65.5,
blue: 34.0,
}
§Standard Colors
get_standard_colors
just gets the standard Minecraft colors in form of a HashMap<String, [u8;3]>
§Optional Features
serde
: Derives Serialize and Deserialize for custom datatypes
Structs§
- Panes
- Represents some glass panes, their DE2000 distance to the target and their calculated color
- PreciseRGB
- Represents a RGB color using f64
Functions§
- calculate_
color_ from_ panes_ custom - Calculates the color of some glass panes using custom colors
- calculate_
color_ from_ panes_ default - Calculates the color of some glass panes using the default Minecraft colors
- find_
combination_ custom - Calculates the most precise combination with the given values (excl. custom Colors)
- find_
combination_ custom_ colors - Calculates the most precise combination with the given values (incl. custom Colors)
- find_
combination_ default - Calculates the most precise combination with the default values
- get_
standard_ colors - Gets the standard Minecraft colors