More theming work
This commit is contained in:
parent
43cd48acb5
commit
ad86a31afb
6 changed files with 44 additions and 37 deletions
|
@ -2,18 +2,17 @@
|
||||||
|
|
||||||
// https://coolors.co/25a35a-3c91e6-f50000-f2f4ff-e9ce2c
|
// https://coolors.co/25a35a-3c91e6-f50000-f2f4ff-e9ce2c
|
||||||
$text-color-light: rgba(7, 59, 58, 1);
|
$text-color-light: rgba(7, 59, 58, 1);
|
||||||
$background-color-light: white;
|
$background-color-light: hsla(272, 32%, 97%, 1);
|
||||||
|
$green-light: hsla(145, 63%, 50%, 1);
|
||||||
$green: hsla(145, 63%, 39%, 1);
|
$red-light: hsla(0, 100%, 48%, 1);
|
||||||
$blue: hsla(210, 77%, 57%, 1);
|
|
||||||
$red: hsla(0, 100%, 48%, 1);
|
|
||||||
$yellow: hsla(51, 81%, 54%, 1);
|
|
||||||
|
|
||||||
$background-color-dark: hsla(222, 19%, 27%, 1);
|
$background-color-dark: hsla(222, 19%, 27%, 1);
|
||||||
$text-color-dark: hsla(60, 15%, 95%, 1);
|
$text-color-dark: hsla(60, 15%, 95%, 1);
|
||||||
|
$green-dark: color.scale($green-light, $lightness: -20%);
|
||||||
|
$red-dark: color.scale($red-light, $lightness: -20%);
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
@for $i from 0 to 3 {
|
@for $i from 0 to 4 {
|
||||||
--background-color-#{$i+1}: #{color.scale(
|
--background-color-#{$i+1}: #{color.scale(
|
||||||
$background-color-light,
|
$background-color-light,
|
||||||
$lightness: -$i * 5%
|
$lightness: -$i * 5%
|
||||||
|
@ -23,15 +22,12 @@ $text-color-dark: hsla(60, 15%, 95%, 1);
|
||||||
$lightness: $i * 10%
|
$lightness: $i * 10%
|
||||||
)};
|
)};
|
||||||
|
|
||||||
--green-#{$i+1}: #{color.scale($green, $lightness: -$i * 10%)};
|
--green-#{$i+1}: #{color.scale($green-light, $lightness: -$i * 10%)};
|
||||||
--red-#{$i+1}: #{color.scale($red, $lightness: -$i * 10%)};
|
--red-#{$i+1}: #{color.scale($red-light, $lightness: -$i * 10%)};
|
||||||
}
|
}
|
||||||
|
|
||||||
--blue: #{$blue};
|
|
||||||
--yellow: #{$yellow};
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
@for $i from 0 to 3 {
|
@for $i from 0 to 4 {
|
||||||
--background-color-#{$i+1}: #{color.scale(
|
--background-color-#{$i+1}: #{color.scale(
|
||||||
$background-color-dark,
|
$background-color-dark,
|
||||||
$lightness: $i * 10%
|
$lightness: $i * 10%
|
||||||
|
@ -40,10 +36,8 @@ $text-color-dark: hsla(60, 15%, 95%, 1);
|
||||||
$text-color-dark,
|
$text-color-dark,
|
||||||
$lightness: -$i * 10%
|
$lightness: -$i * 10%
|
||||||
)};
|
)};
|
||||||
|
--green-#{$i+1}: #{color.scale($green-dark, $lightness: -$i * 10%)};
|
||||||
|
--red-#{$i+1}: #{color.scale($red-dark, $lightness: -$i * 10%)};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
* {
|
|
||||||
color: var(--text-color-1);
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,26 +2,20 @@
|
||||||
import { Communicator } from "../../communication";
|
import { Communicator } from "../../communication";
|
||||||
|
|
||||||
export let trans: Translation;
|
export let trans: Translation;
|
||||||
let card: Flashcard;
|
let card: Flashcard | undefined;
|
||||||
$: card = undefined;
|
|
||||||
|
|
||||||
const addFlashcard = async () => {
|
const addFlashcard = async () => {
|
||||||
card = await Communicator.addFlashcard(trans);
|
card = await Communicator.addFlashcard(trans);
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeFlashcard = async () => {
|
const removeFlashcard = async () => {
|
||||||
await Communicator.removeFlashcard(card);
|
if (card) await Communicator.removeFlashcard(card);
|
||||||
card = undefined;
|
card = undefined;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
:global(:root) {
|
@use "../color_scheme";
|
||||||
--background-color: $blackish;
|
|
||||||
--green: $green;
|
|
||||||
--blue: $blue;
|
|
||||||
--yellow: $yellow;
|
|
||||||
}
|
|
||||||
|
|
||||||
.translatedContainer {
|
.translatedContainer {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -33,7 +27,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
color: white;
|
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
border: 0;
|
border: 0;
|
||||||
min-width: 9ch;
|
min-width: 9ch;
|
||||||
|
@ -42,11 +35,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.remove {
|
.remove {
|
||||||
background-color: red;
|
background-color: var(--red-1);
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--red-2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.add {
|
.add {
|
||||||
background-color: #25a35a;
|
background-color: var(--green-1);
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--green-2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { Communicator } from "../../communication";
|
import { Communicator } from "../../communication";
|
||||||
import tippy from "tippy.js";
|
import tippy, { roundArrow } from "tippy.js";
|
||||||
import App from "./Translate.svelte";
|
import App from "./Translate.svelte";
|
||||||
import "tippy.js/dist/tippy.css";
|
|
||||||
import "./tippy.scss";
|
import "./tippy.scss";
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
|
@ -36,9 +35,10 @@ import "./tippy.scss";
|
||||||
});
|
});
|
||||||
return tippy(document.body, {
|
return tippy(document.body, {
|
||||||
content: svelteElement,
|
content: svelteElement,
|
||||||
allowHTML: true,
|
|
||||||
trigger: "manual",
|
trigger: "manual",
|
||||||
interactive: true,
|
interactive: true,
|
||||||
|
arrow: roundArrow,
|
||||||
|
theme: "webext",
|
||||||
getReferenceClientRect: () =>
|
getReferenceClientRect: () =>
|
||||||
document.getSelection()!.getRangeAt(0).getBoundingClientRect(),
|
document.getSelection()!.getRangeAt(0).getBoundingClientRect(),
|
||||||
onCreate: (instance) => {
|
onCreate: (instance) => {
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
|
@use "../color_scheme";
|
||||||
|
@import "tippy.js/dist/tippy.css";
|
||||||
|
@import "tippy.js/dist/svg-arrow.css";
|
||||||
|
|
||||||
|
.tippy-box[data-theme~="webext"] {
|
||||||
|
background-color: var(--background-color-1);
|
||||||
|
tippy-svg-arrow {
|
||||||
|
fill: var(--background-color-1);
|
||||||
|
}
|
||||||
|
|
||||||
.tippy-content {
|
.tippy-content {
|
||||||
user-select: none;
|
user-select: none;
|
||||||
* {
|
* {
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
color: var(--text-color-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
@use "../color_scheme.scss";
|
@use "../color_scheme.scss";
|
||||||
.select-styling {
|
.select-styling {
|
||||||
--background: var(--background-color-3);
|
--background: var(--background-color-3);
|
||||||
--itemIsActiveBG: var(--background-color-1);
|
--itemIsActiveBG: var(--background-color-4);
|
||||||
--itemHoverBG: var(--background-color-3);
|
--itemHoverBG: var(--background-color-3);
|
||||||
--listBackground: var(--background-color-2);
|
--listBackground: var(--background-color-2);
|
||||||
--inputColor: var(--text-color-1);
|
--inputColor: var(--text-color-1);
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
input {
|
input {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
label {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -42,6 +41,9 @@
|
||||||
height: 8vh;
|
height: 8vh;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-radius: 10vw;
|
border-radius: 10vw;
|
||||||
|
|
||||||
|
font-weight: 500;
|
||||||
|
|
||||||
background-color: var(--green-1);
|
background-color: var(--green-1);
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: var(--green-2);
|
background-color: var(--green-2);
|
||||||
|
|
Loading…
Reference in a new issue