Skip to content

Commit bf3b8f7

Browse files
Material Engcopybara-github
authored andcommitted
Add SchemeRainbow and SchemeFruitSalad to MCU Java.
PiperOrigin-RevId: 535327804
1 parent 5b92e72 commit bf3b8f7

File tree

3 files changed

+78
-1
lines changed

3 files changed

+78
-1
lines changed

java/scheme/SchemeFruitSalad.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2023 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package scheme;
17+
18+
import hct.Hct;
19+
import palettes.TonalPalette;
20+
import utils.MathUtils;
21+
22+
/** A playful theme - the source color's hue does not appear in the theme. */
23+
public class SchemeFruitSalad extends DynamicScheme {
24+
public SchemeFruitSalad(Hct sourceColorHct, boolean isDark, double contrastLevel) {
25+
super(
26+
sourceColorHct,
27+
Variant.FRUIT_SALAD,
28+
isDark,
29+
contrastLevel,
30+
TonalPalette.fromHueAndChroma(
31+
MathUtils.sanitizeDegreesDouble(sourceColorHct.getHue() - 50.0), 48.0),
32+
TonalPalette.fromHueAndChroma(
33+
MathUtils.sanitizeDegreesDouble(sourceColorHct.getHue() - 50.0), 36.0),
34+
TonalPalette.fromHueAndChroma(sourceColorHct.getHue(), 36.0),
35+
TonalPalette.fromHueAndChroma(sourceColorHct.getHue(), 10.0),
36+
TonalPalette.fromHueAndChroma(sourceColorHct.getHue(), 16.0));
37+
}
38+
}

java/scheme/SchemeRainbow.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright 2023 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package scheme;
17+
18+
import hct.Hct;
19+
import palettes.TonalPalette;
20+
import utils.MathUtils;
21+
22+
/** A playful theme - the source color's hue does not appear in the theme. */
23+
public class SchemeRainbow extends DynamicScheme {
24+
public SchemeRainbow(Hct sourceColorHct, boolean isDark, double contrastLevel) {
25+
super(
26+
sourceColorHct,
27+
Variant.RAINBOW,
28+
isDark,
29+
contrastLevel,
30+
TonalPalette.fromHueAndChroma(sourceColorHct.getHue(), 48.0),
31+
TonalPalette.fromHueAndChroma(sourceColorHct.getHue(), 16.0),
32+
TonalPalette.fromHueAndChroma(
33+
MathUtils.sanitizeDegreesDouble(sourceColorHct.getHue() + 60.0), 24.0),
34+
TonalPalette.fromHueAndChroma(sourceColorHct.getHue(), 0.0),
35+
TonalPalette.fromHueAndChroma(sourceColorHct.getHue(), 0.0));
36+
}
37+
}

java/scheme/Variant.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,7 @@ public enum Variant {
2323
VIBRANT,
2424
EXPRESSIVE,
2525
FIDELITY,
26-
CONTENT
26+
CONTENT,
27+
RAINBOW,
28+
FRUIT_SALAD
2729
}

0 commit comments

Comments
 (0)