mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
feat: accent color based on folder color, closes #762
This commit is contained in:
@ -99,7 +99,7 @@ onMounted(() => {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: $primary-color;
|
||||
background: var(--primary-color);
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 0 5px 1px darken($body-font-color-dark, 40%);
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ onBeforeUnmount(() => {
|
||||
outline: none;
|
||||
|
||||
&:focus {
|
||||
box-shadow: 0 0 3px 0.1rem rgba($primary-color, 80%);
|
||||
box-shadow: 0 0 3px 0.1rem rgba(var(--primary-color), 80%);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
|
@ -204,7 +204,7 @@ onBeforeUnmount(() => {
|
||||
cursor: pointer;
|
||||
|
||||
&.selected {
|
||||
outline: 2px solid $primary-color;
|
||||
outline: 2px solid var(--primary-color);
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ onBeforeUnmount(() => {
|
||||
max-width: 100%;
|
||||
display: inline-block;
|
||||
font-size: 100%;
|
||||
// color: $primary-color;
|
||||
// color: var(--primary-color);
|
||||
opacity: 0.8;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
@ -703,7 +703,7 @@ onBeforeUnmount(() => {
|
||||
|
||||
&.selected {
|
||||
img {
|
||||
box-shadow: 0 0 0 3px $primary-color;
|
||||
box-shadow: 0 0 0 3px var(--primary-color);
|
||||
}
|
||||
}
|
||||
|
||||
@ -731,7 +731,7 @@ onBeforeUnmount(() => {
|
||||
|
||||
.badge-update::after {
|
||||
bottom: initial;
|
||||
background: $primary-color;
|
||||
background: var(--primary-color);
|
||||
}
|
||||
|
||||
.form-label {
|
||||
|
@ -409,7 +409,7 @@ defineExpose({ editor });
|
||||
position: absolute;
|
||||
left: 3px;
|
||||
top: 2px;
|
||||
color: $primary-color;
|
||||
color: var(--primary-color);
|
||||
display: inline-block;
|
||||
font: normal normal normal 24px/1 "Material Design Icons", sans-serif;
|
||||
font-size: inherit;
|
||||
|
@ -85,10 +85,11 @@
|
||||
<script setup lang="ts">
|
||||
import { shell } from 'electron';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed, ComputedRef } from 'vue';
|
||||
import { computed, ComputedRef, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import BaseIcon from '@/components/BaseIcon.vue';
|
||||
import { hexToRGBA } from '@/libs/hexToRgba';
|
||||
import { useApplicationStore } from '@/stores/application';
|
||||
import { useConnectionsStore } from '@/stores/connections';
|
||||
import { useConsoleStore } from '@/stores/console';
|
||||
@ -117,7 +118,11 @@ const { getWorkspace } = workspacesStore;
|
||||
const { getConnectionFolder, getConnectionByUid } = connectionsStore;
|
||||
|
||||
const workspace = computed(() => getWorkspace(workspaceUid.value));
|
||||
const footerColor = computed(() => getConnectionFolder(workspaceUid.value)?.color || '#E36929');
|
||||
const footerColor = computed(() => {
|
||||
if (getConnectionFolder(workspaceUid.value)?.color)
|
||||
return getConnectionFolder(workspaceUid.value).color;
|
||||
return '#E36929';
|
||||
});
|
||||
const connectionInfos = computed(() => getConnectionByUid(workspaceUid.value));
|
||||
const version: ComputedRef<DatabaseInfos> = computed(() => {
|
||||
return getWorkspace(workspaceUid.value) ? workspace.value.version : null;
|
||||
@ -129,6 +134,11 @@ const versionString = computed(() => {
|
||||
return '';
|
||||
});
|
||||
|
||||
watch(footerColor, () => {
|
||||
document.querySelector<HTMLBodyElement>(':root').style.setProperty('--primary-color', footerColor.value);
|
||||
document.querySelector<HTMLBodyElement>(':root').style.setProperty('--primary-color-shadow', hexToRGBA(footerColor.value, 0.2));
|
||||
});
|
||||
|
||||
const openOutside = (link: string) => shell.openExternal(link);
|
||||
</script>
|
||||
|
||||
|
@ -233,6 +233,7 @@ if (!connectionsArr.value.length)
|
||||
border-radius: 0;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
border: none;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
|
@ -501,7 +501,7 @@ const toggleSearchMethod = () => {
|
||||
transition: background 0.2s;
|
||||
|
||||
&:hover {
|
||||
background: rgba($primary-color, 50%);
|
||||
background: rgba(var(--primary-color), 50%);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ onMounted(() => {
|
||||
transition: background 0.2s;
|
||||
|
||||
&:hover {
|
||||
background: rgba($primary-color, 50%);
|
||||
background: rgba(var(--primary-color), 50%);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -821,7 +821,7 @@ onBeforeUnmount(() => {
|
||||
transition: background 0.2s;
|
||||
|
||||
&:hover {
|
||||
background: rgba($primary-color, 50%);
|
||||
background: rgba(var(--primary-color), 50%);
|
||||
}
|
||||
}
|
||||
|
||||
|
18
src/renderer/libs/colorShade.ts
Normal file
18
src/renderer/libs/colorShade.ts
Normal file
@ -0,0 +1,18 @@
|
||||
export const colorShade = (color: string, amount: number) => {
|
||||
color = color.replaceAll('#', '');
|
||||
if (color.length === 3) color = color[0] + color[0] + color[1] + color[1] + color[2] + color[2];
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let [r, g, b] = color.match(/.{2}/g) as any;
|
||||
([r, g, b] = [parseInt(r, 16) + amount, parseInt(g, 16) + amount, parseInt(b, 16) + amount]);
|
||||
|
||||
r = Math.max(Math.min(255, r), 0).toString(16);
|
||||
g = Math.max(Math.min(255, g), 0).toString(16);
|
||||
b = Math.max(Math.min(255, b), 0).toString(16);
|
||||
|
||||
const rr = (r.length < 2 ? '0' : '') + r;
|
||||
const gg = (g.length < 2 ? '0' : '') + g;
|
||||
const bb = (b.length < 2 ? '0' : '') + b;
|
||||
|
||||
return `#${rr}${gg}${bb}`;
|
||||
};
|
16
src/renderer/libs/hexToRgba.ts
Normal file
16
src/renderer/libs/hexToRgba.ts
Normal file
@ -0,0 +1,16 @@
|
||||
export const hexToRGBA = (hexCode: string, opacity = 1) => {
|
||||
let hex = hexCode.replace('#', '');
|
||||
|
||||
if (hex.length === 3)
|
||||
hex = `${hex[0]}${hex[0]}${hex[1]}${hex[1]}${hex[2]}${hex[2]}`;
|
||||
|
||||
const r = parseInt(hex.substring(0, 2), 16);
|
||||
const g = parseInt(hex.substring(2, 4), 16);
|
||||
const b = parseInt(hex.substring(4, 6), 16);
|
||||
|
||||
/* Backward compatibility for whole number based opacity values. */
|
||||
if (opacity > 1 && opacity <= 100)
|
||||
opacity = opacity / 100;
|
||||
|
||||
return `rgba(${r},${g},${b},${opacity})`;
|
||||
};
|
@ -1,5 +1,5 @@
|
||||
/* Colors */
|
||||
$body-bg: #fdfdfd;
|
||||
$body-bg: #f3f3f3;
|
||||
$body-bg-dark: #1d1d1d;
|
||||
$body-font-color-dark: #fff;
|
||||
$bg-color-dark: #1d1d1d;
|
||||
|
@ -1,4 +1,10 @@
|
||||
/* stylelint-disable */
|
||||
:root {
|
||||
--primary-color: #e36929;
|
||||
--primary-color-dark: color-mix(in srgb, var(--primary-color), #000 30%);
|
||||
--primary-color-shadow: 0 0 0 0.1rem rgba(227, 105, 41, 0.2);
|
||||
}
|
||||
|
||||
@import "~spectre.css/src/variables";
|
||||
@import "variables";
|
||||
@import "transitions";
|
||||
@ -16,12 +22,16 @@ body {
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
::selection,
|
||||
option:hover,
|
||||
option:focus,
|
||||
option:active,
|
||||
option:checked {
|
||||
background-color: $primary-color;
|
||||
background-color: var(--primary-color);
|
||||
color: $light-color;
|
||||
}
|
||||
|
||||
@ -248,7 +258,7 @@ option:checked {
|
||||
height: 2px;
|
||||
width: 0;
|
||||
transition: width 0.2s;
|
||||
background-color: $primary-color;
|
||||
background-color: var(--primary-color);
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
}
|
||||
@ -300,9 +310,23 @@ option:checked {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.form-checkbox input:checked + .form-icon, .form-radio input:checked + .form-icon, .form-switch input:checked + .form-icon {
|
||||
background: var(--primary-color);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
|
||||
.form-checkbox input:focus + .form-icon, .form-radio input:focus + .form-icon, .form-switch input:focus + .form-icon {
|
||||
box-shadow: 0 0 0 0.1rem var(--primary-color-shadow);
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
|
||||
.form-select {
|
||||
cursor: pointer;
|
||||
|
||||
&:focus {
|
||||
box-shadow: 0 0 0 0.1rem var(--primary-color-shadow);
|
||||
}
|
||||
|
||||
&.small-select {
|
||||
height: 21px;
|
||||
font-size: 0.7rem;
|
||||
@ -311,7 +335,8 @@ option:checked {
|
||||
|
||||
&.select {
|
||||
&.select--open {
|
||||
border-color: $primary-color !important;
|
||||
border-color: var(--primary-color) !important;
|
||||
box-shadow: 0 0 0 0.1rem var(--primary-color-shadow) !important;
|
||||
|
||||
@include control-shadow();
|
||||
}
|
||||
@ -336,19 +361,28 @@ option:checked {
|
||||
z-index: 401 !important;
|
||||
border: 1px solid transparent;
|
||||
border-radius: $border-radius;
|
||||
box-shadow: 0 8px 17px 0 rgb(0 0 0 / 20%), 0 6px 20px 0 rgb(0 0 0 / 19%);
|
||||
box-shadow:
|
||||
0 8px 17px 0 rgb(0 0 0 / 20%),
|
||||
0 6px 20px 0 rgb(0 0 0 / 19%);
|
||||
}
|
||||
|
||||
.select__option--selected {
|
||||
background: rgba($primary-color, 0.25);
|
||||
background: rgba(var(--primary-color), 0.25);
|
||||
}
|
||||
|
||||
.select__option--highlight {
|
||||
background: $primary-color;
|
||||
background: var(--primary-color);
|
||||
text-shadow: 0 0 15px #000;
|
||||
}
|
||||
|
||||
.form-input[type="file"] {
|
||||
.form-input {
|
||||
&[type="file"] {
|
||||
overflow: hidden;
|
||||
}
|
||||
&:focus {
|
||||
border-color: var(--primary-color);
|
||||
box-shadow: 0 0 0 0.1rem var(--primary-color-shadow);
|
||||
}
|
||||
}
|
||||
|
||||
.input-group .input-group-addon {
|
||||
@ -370,13 +404,34 @@ option:checked {
|
||||
}
|
||||
|
||||
.btn {
|
||||
color: var(--primary-color);
|
||||
border-color: var(--primary-color);
|
||||
|
||||
&:not(.btn-link) {
|
||||
text-shadow: 0 0 15px #000;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
border-color: var(--primary-color-dark);
|
||||
}
|
||||
|
||||
&:focus {
|
||||
box-shadow: 0 0 3px 1px rgba($primary-color, 90%);
|
||||
box-shadow: 0 0 3px 1px rgba(var(--primary-color), 90%);
|
||||
}
|
||||
|
||||
&.btn-success:focus {
|
||||
border-color: $primary-color;
|
||||
box-shadow: 0 0 3px 1px rgba($primary-color, 90%);
|
||||
border-color: var(--primary-color);
|
||||
box-shadow: 0 0 3px 1px rgba(var(--primary-color), 90%);
|
||||
}
|
||||
|
||||
&.btn-primary {
|
||||
background: var(--primary-color);
|
||||
border-color: var(--primary-color-dark);
|
||||
|
||||
&:hover {
|
||||
background: var(--primary-color-dark);
|
||||
border-color: var(--primary-color-dark);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -435,7 +490,7 @@ code.sql {
|
||||
}
|
||||
|
||||
.sql-hl-keyword {
|
||||
color: $primary-color;
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
.sql-hl-function {
|
||||
|
@ -33,12 +33,41 @@
|
||||
|
||||
.menu-item a {
|
||||
&:hover {
|
||||
color: $primary-color;
|
||||
color: var(--primary-color);
|
||||
background: $bg-color-gray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tab {
|
||||
.tab-item {
|
||||
a {
|
||||
color: $body-font-color-dark;
|
||||
opacity: .7;
|
||||
|
||||
&:hover {
|
||||
color: $body-font-color-dark;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&.active {
|
||||
a {
|
||||
color: $body-font-color-dark;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.tab-link {
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
&::after {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.btn {
|
||||
&.btn-link {
|
||||
color: rgba($body-font-color-dark, 0.8);
|
||||
@ -67,7 +96,7 @@
|
||||
}
|
||||
|
||||
&.active {
|
||||
background-color: $primary-color;
|
||||
background-color: var(--primary-color);
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,7 +153,7 @@
|
||||
}
|
||||
|
||||
.form-select:not([multiple], [size]):focus {
|
||||
border-color: $primary-color;
|
||||
border-color: var(--primary-color);
|
||||
}
|
||||
|
||||
.select {
|
||||
@ -432,7 +461,7 @@
|
||||
.settingbar-element {
|
||||
.settingbar-element-icon {
|
||||
&.badge-update::after {
|
||||
background: $primary-color;
|
||||
background: var(--primary-color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -447,7 +476,7 @@
|
||||
}
|
||||
|
||||
#footer {
|
||||
background: $primary-color;
|
||||
background: var(--primary-color);
|
||||
box-shadow: 0 0 1px 0 #000;
|
||||
|
||||
.footer-elements {
|
||||
|
@ -530,8 +530,17 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
return {
|
||||
...workspace,
|
||||
tabs: workspace.tabs.map(tab => {
|
||||
if (tab.uid === tUid)
|
||||
return { ...tab, type, schema, content, elementName, elementType, filePath };
|
||||
if (tab.uid === tUid) {
|
||||
return {
|
||||
...tab,
|
||||
type,
|
||||
schema,
|
||||
content,
|
||||
elementName,
|
||||
elementType,
|
||||
filePath
|
||||
};
|
||||
}
|
||||
|
||||
return tab;
|
||||
})
|
||||
@ -603,17 +612,47 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
});
|
||||
|
||||
tabUid = uidGen('T');
|
||||
this._addTab({ uid, tab: tabUid, content, type, autorun, database: workspaceTabs.database, schema, elementName, elementType, filePath });
|
||||
this._addTab({
|
||||
uid,
|
||||
tab: tabUid,
|
||||
content,
|
||||
type,
|
||||
autorun,
|
||||
database: workspaceTabs.database,
|
||||
schema,
|
||||
elementName,
|
||||
elementType,
|
||||
filePath
|
||||
});
|
||||
}
|
||||
else {
|
||||
this._replaceTab({ uid, tab: tab.uid, type, schema, elementName, elementType, filePath });
|
||||
this._replaceTab({
|
||||
uid,
|
||||
tab: tab.uid,
|
||||
type,
|
||||
schema,
|
||||
elementName,
|
||||
elementType,
|
||||
filePath
|
||||
});
|
||||
tabUid = tab.uid;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
tabUid = uidGen('T');
|
||||
this._addTab({ uid, tab: tabUid, content, type, autorun, database: workspaceTabs.database, schema, elementName, elementType, filePath });
|
||||
this._addTab({
|
||||
uid,
|
||||
tab: tabUid,
|
||||
content,
|
||||
type,
|
||||
autorun,
|
||||
database: workspaceTabs.database,
|
||||
schema,
|
||||
elementName,
|
||||
elementType,
|
||||
filePath
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user