Return ColorScaleSets from individual color scale functions (#3197)

This PR adjusts the individual color scale functions to return
`ColorScaleSet`s instead of `DefaultColorScaleSet`s.

We only use the `DefaultColorScaleSet`s to simplify the construction of
the scales, so it isn't necessary to surface them outside of the
function.

Release Notes:

-  N/A
This commit is contained in:
Marshall Bowers 2023-11-01 15:45:42 +01:00 committed by GitHub
parent 1b9619ca7f
commit bbe53895ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -299,43 +299,43 @@ impl From<DefaultColorScaleSet> for ColorScaleSet {
pub fn default_color_scales() -> ColorScales { pub fn default_color_scales() -> ColorScales {
ColorScales { ColorScales {
gray: gray().into(), gray: gray(),
mauve: mauve().into(), mauve: mauve(),
slate: slate().into(), slate: slate(),
sage: sage().into(), sage: sage(),
olive: olive().into(), olive: olive(),
sand: sand().into(), sand: sand(),
gold: gold().into(), gold: gold(),
bronze: bronze().into(), bronze: bronze(),
brown: brown().into(), brown: brown(),
yellow: yellow().into(), yellow: yellow(),
amber: amber().into(), amber: amber(),
orange: orange().into(), orange: orange(),
tomato: tomato().into(), tomato: tomato(),
red: red().into(), red: red(),
ruby: ruby().into(), ruby: ruby(),
crimson: crimson().into(), crimson: crimson(),
pink: pink().into(), pink: pink(),
plum: plum().into(), plum: plum(),
purple: purple().into(), purple: purple(),
violet: violet().into(), violet: violet(),
iris: iris().into(), iris: iris(),
indigo: indigo().into(), indigo: indigo(),
blue: blue().into(), blue: blue(),
cyan: cyan().into(), cyan: cyan(),
teal: teal().into(), teal: teal(),
jade: jade().into(), jade: jade(),
green: green().into(), green: green(),
grass: grass().into(), grass: grass(),
lime: lime().into(), lime: lime(),
mint: mint().into(), mint: mint(),
sky: sky().into(), sky: sky(),
black: black().into(), black: black(),
white: white().into(), white: white(),
} }
} }
fn gray() -> DefaultColorScaleSet { fn gray() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Gray", scale: "Gray",
light: [ light: [
@ -395,9 +395,10 @@ fn gray() -> DefaultColorScaleSet {
"#ffffffed", "#ffffffed",
], ],
} }
.into()
} }
fn mauve() -> DefaultColorScaleSet { fn mauve() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Mauve", scale: "Mauve",
light: [ light: [
@ -457,9 +458,10 @@ fn mauve() -> DefaultColorScaleSet {
"#fdfdffef", "#fdfdffef",
], ],
} }
.into()
} }
fn slate() -> DefaultColorScaleSet { fn slate() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Slate", scale: "Slate",
light: [ light: [
@ -519,9 +521,10 @@ fn slate() -> DefaultColorScaleSet {
"#fcfdffef", "#fcfdffef",
], ],
} }
.into()
} }
fn sage() -> DefaultColorScaleSet { fn sage() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Sage", scale: "Sage",
light: [ light: [
@ -581,9 +584,10 @@ fn sage() -> DefaultColorScaleSet {
"#fdfffeed", "#fdfffeed",
], ],
} }
.into()
} }
fn olive() -> DefaultColorScaleSet { fn olive() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Olive", scale: "Olive",
light: [ light: [
@ -643,9 +647,10 @@ fn olive() -> DefaultColorScaleSet {
"#fdfffded", "#fdfffded",
], ],
} }
.into()
} }
fn sand() -> DefaultColorScaleSet { fn sand() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Sand", scale: "Sand",
light: [ light: [
@ -705,9 +710,10 @@ fn sand() -> DefaultColorScaleSet {
"#fffffded", "#fffffded",
], ],
} }
.into()
} }
fn gold() -> DefaultColorScaleSet { fn gold() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Gold", scale: "Gold",
light: [ light: [
@ -767,9 +773,10 @@ fn gold() -> DefaultColorScaleSet {
"#fef7ede7", "#fef7ede7",
], ],
} }
.into()
} }
fn bronze() -> DefaultColorScaleSet { fn bronze() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Bronze", scale: "Bronze",
light: [ light: [
@ -829,9 +836,10 @@ fn bronze() -> DefaultColorScaleSet {
"#fff1e9ec", "#fff1e9ec",
], ],
} }
.into()
} }
fn brown() -> DefaultColorScaleSet { fn brown() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Brown", scale: "Brown",
light: [ light: [
@ -891,9 +899,10 @@ fn brown() -> DefaultColorScaleSet {
"#feecd4f2", "#feecd4f2",
], ],
} }
.into()
} }
fn yellow() -> DefaultColorScaleSet { fn yellow() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Yellow", scale: "Yellow",
light: [ light: [
@ -953,9 +962,10 @@ fn yellow() -> DefaultColorScaleSet {
"#fef6baf6", "#fef6baf6",
], ],
} }
.into()
} }
fn amber() -> DefaultColorScaleSet { fn amber() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Amber", scale: "Amber",
light: [ light: [
@ -1015,9 +1025,10 @@ fn amber() -> DefaultColorScaleSet {
"#ffe7b3ff", "#ffe7b3ff",
], ],
} }
.into()
} }
fn orange() -> DefaultColorScaleSet { fn orange() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Orange", scale: "Orange",
light: [ light: [
@ -1077,9 +1088,10 @@ fn orange() -> DefaultColorScaleSet {
"#ffe0c2ff", "#ffe0c2ff",
], ],
} }
.into()
} }
fn tomato() -> DefaultColorScaleSet { fn tomato() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Tomato", scale: "Tomato",
light: [ light: [
@ -1139,9 +1151,10 @@ fn tomato() -> DefaultColorScaleSet {
"#ffd6cefb", "#ffd6cefb",
], ],
} }
.into()
} }
fn red() -> DefaultColorScaleSet { fn red() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Red", scale: "Red",
light: [ light: [
@ -1201,9 +1214,10 @@ fn red() -> DefaultColorScaleSet {
"#ffd1d9ff", "#ffd1d9ff",
], ],
} }
.into()
} }
fn ruby() -> DefaultColorScaleSet { fn ruby() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Ruby", scale: "Ruby",
light: [ light: [
@ -1263,9 +1277,10 @@ fn ruby() -> DefaultColorScaleSet {
"#ffd3e2fe", "#ffd3e2fe",
], ],
} }
.into()
} }
fn crimson() -> DefaultColorScaleSet { fn crimson() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Crimson", scale: "Crimson",
light: [ light: [
@ -1325,9 +1340,10 @@ fn crimson() -> DefaultColorScaleSet {
"#ffd5eafd", "#ffd5eafd",
], ],
} }
.into()
} }
fn pink() -> DefaultColorScaleSet { fn pink() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Pink", scale: "Pink",
light: [ light: [
@ -1387,9 +1403,10 @@ fn pink() -> DefaultColorScaleSet {
"#ffd3ecfd", "#ffd3ecfd",
], ],
} }
.into()
} }
fn plum() -> DefaultColorScaleSet { fn plum() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Plum", scale: "Plum",
light: [ light: [
@ -1449,9 +1466,10 @@ fn plum() -> DefaultColorScaleSet {
"#feddfef4", "#feddfef4",
], ],
} }
.into()
} }
fn purple() -> DefaultColorScaleSet { fn purple() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Purple", scale: "Purple",
light: [ light: [
@ -1511,9 +1529,10 @@ fn purple() -> DefaultColorScaleSet {
"#f1ddfffa", "#f1ddfffa",
], ],
} }
.into()
} }
fn violet() -> DefaultColorScaleSet { fn violet() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Violet", scale: "Violet",
light: [ light: [
@ -1573,9 +1592,10 @@ fn violet() -> DefaultColorScaleSet {
"#e3defffe", "#e3defffe",
], ],
} }
.into()
} }
fn iris() -> DefaultColorScaleSet { fn iris() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Iris", scale: "Iris",
light: [ light: [
@ -1635,9 +1655,10 @@ fn iris() -> DefaultColorScaleSet {
"#e1e0fffe", "#e1e0fffe",
], ],
} }
.into()
} }
fn indigo() -> DefaultColorScaleSet { fn indigo() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Indigo", scale: "Indigo",
light: [ light: [
@ -1697,9 +1718,10 @@ fn indigo() -> DefaultColorScaleSet {
"#d6e1ffff", "#d6e1ffff",
], ],
} }
.into()
} }
fn blue() -> DefaultColorScaleSet { fn blue() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Blue", scale: "Blue",
light: [ light: [
@ -1759,9 +1781,10 @@ fn blue() -> DefaultColorScaleSet {
"#c2e6ffff", "#c2e6ffff",
], ],
} }
.into()
} }
fn cyan() -> DefaultColorScaleSet { fn cyan() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Cyan", scale: "Cyan",
light: [ light: [
@ -1821,9 +1844,10 @@ fn cyan() -> DefaultColorScaleSet {
"#bbf3fef7", "#bbf3fef7",
], ],
} }
.into()
} }
fn teal() -> DefaultColorScaleSet { fn teal() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Teal", scale: "Teal",
light: [ light: [
@ -1883,9 +1907,10 @@ fn teal() -> DefaultColorScaleSet {
"#b8ffebef", "#b8ffebef",
], ],
} }
.into()
} }
fn jade() -> DefaultColorScaleSet { fn jade() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Jade", scale: "Jade",
light: [ light: [
@ -1945,9 +1970,10 @@ fn jade() -> DefaultColorScaleSet {
"#b8ffe1ef", "#b8ffe1ef",
], ],
} }
.into()
} }
fn green() -> DefaultColorScaleSet { fn green() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Green", scale: "Green",
light: [ light: [
@ -2007,9 +2033,10 @@ fn green() -> DefaultColorScaleSet {
"#bbffd7f0", "#bbffd7f0",
], ],
} }
.into()
} }
fn grass() -> DefaultColorScaleSet { fn grass() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Grass", scale: "Grass",
light: [ light: [
@ -2069,9 +2096,10 @@ fn grass() -> DefaultColorScaleSet {
"#ceffceef", "#ceffceef",
], ],
} }
.into()
} }
fn lime() -> DefaultColorScaleSet { fn lime() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Lime", scale: "Lime",
light: [ light: [
@ -2131,9 +2159,10 @@ fn lime() -> DefaultColorScaleSet {
"#e9febff7", "#e9febff7",
], ],
} }
.into()
} }
fn mint() -> DefaultColorScaleSet { fn mint() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Mint", scale: "Mint",
light: [ light: [
@ -2193,9 +2222,10 @@ fn mint() -> DefaultColorScaleSet {
"#cbfee9f5", "#cbfee9f5",
], ],
} }
.into()
} }
fn sky() -> DefaultColorScaleSet { fn sky() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Sky", scale: "Sky",
light: [ light: [
@ -2255,9 +2285,10 @@ fn sky() -> DefaultColorScaleSet {
"#c2f3ffff", "#c2f3ffff",
], ],
} }
.into()
} }
fn black() -> DefaultColorScaleSet { fn black() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "Black", scale: "Black",
light: [ light: [
@ -2317,9 +2348,10 @@ fn black() -> DefaultColorScaleSet {
"#000000f2", "#000000f2",
], ],
} }
.into()
} }
fn white() -> DefaultColorScaleSet { fn white() -> ColorScaleSet {
DefaultColorScaleSet { DefaultColorScaleSet {
scale: "White", scale: "White",
light: [ light: [
@ -2379,4 +2411,5 @@ fn white() -> DefaultColorScaleSet {
"#fffffff2", "#fffffff2",
], ],
} }
.into()
} }