mirror of
https://github.com/ryanamay/pint.git
synced 2024-09-20 01:50:34 +00:00
pr #31: scheme options
This commit is contained in:
commit
cfefb19196
8 changed files with 36045 additions and 6416 deletions
29238
package-lock.json
generated
Normal file
29238
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -454,6 +454,9 @@ defaultColorScheme = {
|
||||||
__color_calendar_graph_day_L3_border: "rgba(255, 255, 255, 0.05)",
|
__color_calendar_graph_day_L3_border: "rgba(255, 255, 255, 0.05)",
|
||||||
__color_calendar_graph_day_L4_border: "rgba(255, 255, 255, 0.05)",
|
__color_calendar_graph_day_L4_border: "rgba(255, 255, 255, 0.05)",
|
||||||
__color_text_disabled: "#6e7681",
|
__color_text_disabled: "#6e7681",
|
||||||
|
scheme: "analogic",
|
||||||
|
variation: "default",
|
||||||
|
hiddenQS: "true",
|
||||||
};
|
};
|
||||||
|
|
||||||
colorSettings = Object.keys(defaultColorScheme);
|
colorSettings = Object.keys(defaultColorScheme);
|
||||||
|
|
|
@ -454,6 +454,9 @@ defaultColorScheme = {
|
||||||
__color_underlinenav_icon: "#6e7681",
|
__color_underlinenav_icon: "#6e7681",
|
||||||
__color_workflow_card_header_shadow: "rgba(27, 31, 35, 0.04)",
|
__color_workflow_card_header_shadow: "rgba(27, 31, 35, 0.04)",
|
||||||
__color_text_disabled: "#6e7681",
|
__color_text_disabled: "#6e7681",
|
||||||
|
scheme: "analogic",
|
||||||
|
variation: "default",
|
||||||
|
hiddenQS: "true",
|
||||||
};
|
};
|
||||||
|
|
||||||
initialSettings = Object.keys(defaultColorScheme);
|
initialSettings = Object.keys(defaultColorScheme);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import Popup from "./views/Popup";
|
||||||
import Options from "./views/Options";
|
import Options from "./views/Options";
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const [isOptionsUi, setOptionsUI] = useState(window.innerWidth > 375);
|
const [isOptionsUi, setOptionsUI] = useState(window.innerWidth > 475);
|
||||||
|
|
||||||
const updateMedia = () => {
|
const updateMedia = () => {
|
||||||
setOptionsUI(window.innerWidth > 475);
|
setOptionsUI(window.innerWidth > 475);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
html,
|
html,
|
||||||
body {
|
body {
|
||||||
/* width: 375px; */
|
width: 428px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
background-color: #010409;
|
background-color: #010409;
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
|
||||||
|
|
|
@ -6,6 +6,7 @@ import updateScale, { updateSpecific } from "../../methods/helpers/scaleHelper";
|
||||||
import * as scaleHelper from "../../methods/helpers/scaleHelper";
|
import * as scaleHelper from "../../methods/helpers/scaleHelper";
|
||||||
import {
|
import {
|
||||||
pintGetUpdate,
|
pintGetUpdate,
|
||||||
|
pintSetNoReload,
|
||||||
updateMultiple,
|
updateMultiple,
|
||||||
} from "../../methods/helpers/storageHelper";
|
} from "../../methods/helpers/storageHelper";
|
||||||
import { updateOpacity } from "../../methods/helpers/opacityHelper";
|
import { updateOpacity } from "../../methods/helpers/opacityHelper";
|
||||||
|
@ -30,6 +31,9 @@ import { FcIdea } from "react-icons/fc";
|
||||||
|
|
||||||
var defaultValue = "#c0ffee";
|
var defaultValue = "#c0ffee";
|
||||||
|
|
||||||
|
var defaultScheme = "analogic";
|
||||||
|
var defaultVariation = "default";
|
||||||
|
|
||||||
var quickScheme: string[] = [];
|
var quickScheme: string[] = [];
|
||||||
|
|
||||||
export default function QuickChange() {
|
export default function QuickChange() {
|
||||||
|
@ -43,7 +47,10 @@ export default function QuickChange() {
|
||||||
pintGetUpdate(settings.cg60_a371f7[0], setScalePurple);
|
pintGetUpdate(settings.cg60_a371f7[0], setScalePurple);
|
||||||
pintGetUpdate(settings.cg19_26a641[0], setScaleCalendar);
|
pintGetUpdate(settings.cg19_26a641[0], setScaleCalendar);
|
||||||
pintGetUpdate(settings.cg106_ffffff[0], setScaleText);
|
pintGetUpdate(settings.cg106_ffffff[0], setScaleText);
|
||||||
quickScheme = scaleHelper.generateScheme(color, "analogic", "default", 0.5);
|
pintGetUpdate("variation", setVariation);
|
||||||
|
pintGetUpdate("scheme", setScheme);
|
||||||
|
pintGetUpdate("hiddenQS", setHiddenQS);
|
||||||
|
quickScheme = scaleHelper.generateScheme(color, scheme, variation, 0.5);
|
||||||
});
|
});
|
||||||
|
|
||||||
const [color, setColor] = react.useState(`${defaultValue}`);
|
const [color, setColor] = react.useState(`${defaultValue}`);
|
||||||
|
@ -51,6 +58,10 @@ export default function QuickChange() {
|
||||||
// scale colors
|
// scale colors
|
||||||
const [scaleGray, setScaleGray] = react.useState(`${defaultValue}`);
|
const [scaleGray, setScaleGray] = react.useState(`${defaultValue}`);
|
||||||
|
|
||||||
|
const [scheme, setScheme] = react.useState(`${defaultScheme}`);
|
||||||
|
const [variation, setVariation] = react.useState(`${defaultVariation}`);
|
||||||
|
const [hiddenQS, setHiddenQS] = react.useState("true");
|
||||||
|
|
||||||
function paintGray() {
|
function paintGray() {
|
||||||
updateSpecific(color, 0, 0, scales.gray);
|
updateSpecific(color, 0, 0, scales.gray);
|
||||||
setScaleGray(color);
|
setScaleGray(color);
|
||||||
|
@ -110,6 +121,61 @@ export default function QuickChange() {
|
||||||
function paintText() {
|
function paintText() {
|
||||||
updateMultiple(settings.cg106_ffffff, chroma(color).hex());
|
updateMultiple(settings.cg106_ffffff, chroma(color).hex());
|
||||||
setScaleGray(color);
|
setScaleGray(color);
|
||||||
|
quickScheme = scaleHelper.generateScheme(color, scheme, variation, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setDefault() {
|
||||||
|
pintSetNoReload("variation", "default");
|
||||||
|
setVariation("default");
|
||||||
|
quickScheme = scaleHelper.generateScheme(color, scheme, variation, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setPastel() {
|
||||||
|
pintSetNoReload("variation", "pastel");
|
||||||
|
setVariation("pastel");
|
||||||
|
quickScheme = scaleHelper.generateScheme(color, scheme, variation, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setSoft() {
|
||||||
|
pintSetNoReload("variation", "soft");
|
||||||
|
setVariation("soft");
|
||||||
|
quickScheme = scaleHelper.generateScheme(color, scheme, variation, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setLight() {
|
||||||
|
pintSetNoReload("variation", "light");
|
||||||
|
setVariation("light");
|
||||||
|
quickScheme = scaleHelper.generateScheme(color, scheme, variation, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setHard() {
|
||||||
|
pintSetNoReload("variation", "hard");
|
||||||
|
setVariation("hard");
|
||||||
|
quickScheme = scaleHelper.generateScheme(color, scheme, variation, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setPale() {
|
||||||
|
pintSetNoReload("variation", "pale");
|
||||||
|
setVariation("pale");
|
||||||
|
quickScheme = scaleHelper.generateScheme(color, scheme, variation, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setTriade() {
|
||||||
|
pintSetNoReload("scheme", "triade");
|
||||||
|
setScheme("triade");
|
||||||
|
quickScheme = scaleHelper.generateScheme(color, scheme, variation, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setTetrade() {
|
||||||
|
pintSetNoReload("scheme", "tetrade");
|
||||||
|
setScheme("tetrade");
|
||||||
|
quickScheme = scaleHelper.generateScheme(color, scheme, variation, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setAnalogic() {
|
||||||
|
pintSetNoReload("scheme", "analogic");
|
||||||
|
setScheme("analogic");
|
||||||
|
quickScheme = scaleHelper.generateScheme(color, scheme, variation, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
function paintAll() {
|
function paintAll() {
|
||||||
|
@ -127,41 +193,22 @@ export default function QuickChange() {
|
||||||
|
|
||||||
function updateColor(color: string) {
|
function updateColor(color: string) {
|
||||||
setColor(color);
|
setColor(color);
|
||||||
quickScheme = scaleHelper.generateScheme(color, "analogic", "default", 0.5);
|
quickScheme = scaleHelper.generateScheme(color, scheme, variation, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideQS() {
|
||||||
|
if (hiddenQS === "true") {
|
||||||
|
pintSetNoReload("hiddenQS", "false");
|
||||||
|
setHiddenQS("false");
|
||||||
|
} else {
|
||||||
|
pintSetNoReload("hiddenQS", "true");
|
||||||
|
setHiddenQS("true");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="flex flex-col rounded-lg mt-4 mx-3">
|
<div className="pint flex flex-row mx-2 mt-2 mb-1">
|
||||||
<div className="flex-1 flex-col rounded-[6px] bg-[#06193a] border-solid border-[#163e6d] border-2 ">
|
|
||||||
<div className="flex flex-row justify-content text-left text-white justify-left items-center mt-2 ml-2">
|
|
||||||
<FcIdea className="mx-1" />
|
|
||||||
<p className="text-semibold">
|
|
||||||
Need ideas? These colors compliment your current pick!
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div className="flex flex-row justify-content p-1 ml-2 mb-2">
|
|
||||||
{quickScheme.map((qsColor) => {
|
|
||||||
return (
|
|
||||||
<button
|
|
||||||
title="Use this Color"
|
|
||||||
className=" hover:bg-[#40363d] active:bg-[#40363d] focus:outline-none focus:ring focus:bg-[#40363d] p-2 rounded-[6px] h-[15px] w-[15px] border-solid border-[#40363d] flex justify-between mr-1"
|
|
||||||
onClick={() => {
|
|
||||||
setColor(qsColor);
|
|
||||||
}}
|
|
||||||
style={{
|
|
||||||
borderWidth: "2px 2px 2px 2px",
|
|
||||||
borderStyle: "solid",
|
|
||||||
borderColor: "#30363d",
|
|
||||||
backgroundColor: chroma(qsColor).hex(),
|
|
||||||
}}
|
|
||||||
></button>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="pint flex flex-row m-2">
|
|
||||||
<div className="flex-1 flex-col rounded-[6px] m-1 bg-[#010409] border-solid border-[#30363d] border-2 ">
|
<div className="flex-1 flex-col rounded-[6px] m-1 bg-[#010409] border-solid border-[#30363d] border-2 ">
|
||||||
<div className="flex flex-row justify-content text-left text-white justify-left items-center rounded-t-[6px] bg-[#161b22] p-1">
|
<div className="flex flex-row justify-content text-left text-white justify-left items-center rounded-t-[6px] bg-[#161b22] p-1">
|
||||||
<BsFillPaletteFill className="mx-1" size={15} />
|
<BsFillPaletteFill className="mx-1" size={15} />
|
||||||
|
@ -195,7 +242,7 @@ export default function QuickChange() {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-row justify-content text-center text-white justify-center items-center p-1 mt-1">
|
<div className="flex flex-row justify-content text-center text-white justify-center items-center p-1 mt-1">
|
||||||
<div className="flex-start align-left text-l mb-2 rounded-t-lg">
|
<div className="flex-start align-left text-l rounded-t-lg">
|
||||||
<p className="">Click a button to set a color</p>
|
<p className="">Click a button to set a color</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -343,6 +390,154 @@ export default function QuickChange() {
|
||||||
</div> */}
|
</div> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="flex flex-col rounded-lg mb-3 mx-3">
|
||||||
|
<div className="flex-1 flex-col rounded-[6px] bg-[#06193a] border-solid border-[#163e6d] border-2 ">
|
||||||
|
<button
|
||||||
|
className="flex flex-row justify-content text-left text-white justify-left items-center mt-2 ml-2 mb-2"
|
||||||
|
onClick={hideQS}
|
||||||
|
>
|
||||||
|
<FcIdea className="mx-1" />
|
||||||
|
<p className="text-semibold">
|
||||||
|
{hiddenQS === "true"
|
||||||
|
? "Need ideas? Click me to show similar colors!"
|
||||||
|
: "Showing similar colors. Click me to hide!"}
|
||||||
|
</p>
|
||||||
|
</button>
|
||||||
|
<div className={`${hiddenQS === "true" ? "hidden" : ""}`}>
|
||||||
|
<div className="flex flex-row justify-content text-left text-[#3080af] justify-left items-center mt-2 ml-3 mb-1">
|
||||||
|
<p className="text-semibold">Scheme Variations</p>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-row justify-content p-1 ml-2">
|
||||||
|
<button
|
||||||
|
className={`mr-1 ${
|
||||||
|
scheme === "triade"
|
||||||
|
? "bg-[#1f6feb] text-[#ffffff]"
|
||||||
|
: "bg-[#163e6d] text-[#3ba6ff]"
|
||||||
|
} hover:bg-[#1d5393] py-[2px] px-2 justify-between align-middle rounded-full table-cell`}
|
||||||
|
onClick={setTriade}
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
triade{" "}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className={`mr-1 ${
|
||||||
|
scheme === "tetrade"
|
||||||
|
? "bg-[#1f6feb] text-[#ffffff]"
|
||||||
|
: "bg-[#163e6d] text-[#3ba6ff]"
|
||||||
|
} hover:bg-[#1d5393] py-[2px] px-2 justify-between align-middle rounded-full table-cell`}
|
||||||
|
onClick={setTetrade}
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
tetrade{" "}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className={`mr-1 ${
|
||||||
|
scheme === "analogic"
|
||||||
|
? "bg-[#1f6feb] text-[#ffffff]"
|
||||||
|
: "bg-[#163e6d] text-[#3ba6ff]"
|
||||||
|
} hover:bg-[#1d5393] py-[2px] px-2 justify-between align-middle rounded-full table-cell`}
|
||||||
|
onClick={setAnalogic}
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
analogic{" "}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-row justify-content text-left text-[#3080af] justify-left items-center mt-2 ml-3 mb-1">
|
||||||
|
<p className="text-semibold">Color Variations</p>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-row justify-content p-1 ml-2">
|
||||||
|
<button
|
||||||
|
className={`mr-1 ${
|
||||||
|
variation === "default"
|
||||||
|
? "bg-[#1f6feb] text-[#ffffff]"
|
||||||
|
: "bg-[#163e6d] text-[#3ba6ff]"
|
||||||
|
} hover:bg-[#1d5393] py-[2px] px-2 justify-between align-middle rounded-full table-cell`}
|
||||||
|
onClick={setDefault}
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
default{" "}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className={`mr-1 ${
|
||||||
|
variation === "pastel"
|
||||||
|
? "bg-[#1f6feb] text-[#ffffff]"
|
||||||
|
: "bg-[#163e6d] text-[#3ba6ff]"
|
||||||
|
} hover:bg-[#1d5393] py-[2px] px-2 justify-between align-middle rounded-full table-cell`}
|
||||||
|
onClick={setPastel}
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
pastel{" "}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className={`mr-1 ${
|
||||||
|
variation === "soft"
|
||||||
|
? "bg-[#1f6feb] text-[#ffffff]"
|
||||||
|
: "bg-[#163e6d] text-[#3ba6ff]"
|
||||||
|
} hover:bg-[#1d5393] py-[2px] px-2 justify-between align-middle rounded-full table-cell`}
|
||||||
|
onClick={setSoft}
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
soft{" "}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className={`mr-1 ${
|
||||||
|
variation === "light"
|
||||||
|
? "bg-[#1f6feb] text-[#ffffff]"
|
||||||
|
: "bg-[#163e6d] text-[#3ba6ff]"
|
||||||
|
} hover:bg-[#1d5393] py-[2px] px-2 justify-between align-middle rounded-full table-cell`}
|
||||||
|
onClick={setLight}
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
light{" "}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className={`mr-1 ${
|
||||||
|
variation === "hard"
|
||||||
|
? "bg-[#1f6feb] text-[#ffffff]"
|
||||||
|
: "bg-[#163e6d] text-[#3ba6ff]"
|
||||||
|
} hover:bg-[#1d5393] py-[2px] px-2 justify-between align-middle rounded-full table-cell`}
|
||||||
|
onClick={setHard}
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
hard{" "}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className={`mr-1 ${
|
||||||
|
variation === "pale"
|
||||||
|
? "bg-[#1f6feb] text-[#ffffff]"
|
||||||
|
: "bg-[#163e6d] text-[#3ba6ff]"
|
||||||
|
} hover:bg-[#1d5393] py-[2px] px-2 justify-between align-middle rounded-full table-cell`}
|
||||||
|
onClick={setPale}
|
||||||
|
>
|
||||||
|
{" "}
|
||||||
|
pale{" "}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-row justify-content text-left text-[#3080af] justify-left items-center mt-2 ml-3 mb-1">
|
||||||
|
<p className="text-semibold">Generated Colors</p>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-row justify-content p-1 ml-2 mb-2">
|
||||||
|
{quickScheme.map((qsColor) => {
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
title={qsColor}
|
||||||
|
className=" hover:bg-[#40363d] active:bg-[#40363d] focus:outline-none focus:ring focus:bg-[#40363d] p-2 rounded-[6px] h-[15px] w-[15px] border-solid border-[#163e6d] flex justify-between mr-1"
|
||||||
|
onClick={() => {
|
||||||
|
setColor(qsColor);
|
||||||
|
}}
|
||||||
|
style={{
|
||||||
|
borderWidth: "2px 2px 2px 2px",
|
||||||
|
borderStyle: "solid",
|
||||||
|
borderColor: "#30363d",
|
||||||
|
backgroundColor: chroma(qsColor).hex(),
|
||||||
|
}}
|
||||||
|
></button>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,11 +225,18 @@ export function updateAccent(color) {
|
||||||
|
|
||||||
export function generateScheme(color, scheme, variation, distance) {
|
export function generateScheme(color, scheme, variation, distance) {
|
||||||
let s = new ColorScheme();
|
let s = new ColorScheme();
|
||||||
|
if (scheme === "analogic") {
|
||||||
s.from_hex(chroma(color).hex().slice(-6))
|
s.from_hex(chroma(color).hex().slice(-6))
|
||||||
.scheme(scheme)
|
.scheme(scheme)
|
||||||
.variation(variation)
|
.variation(variation)
|
||||||
.add_complement(true)
|
.add_complement(true)
|
||||||
.distance(distance);
|
.distance(distance);
|
||||||
|
} else {
|
||||||
|
s.from_hex(chroma(color).hex().slice(-6))
|
||||||
|
.scheme(scheme)
|
||||||
|
.variation(variation)
|
||||||
|
.distance(distance);
|
||||||
|
}
|
||||||
|
|
||||||
return s.colors();
|
return s.colors();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue