Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
add custom colours to tag and highlight previews
Browse files Browse the repository at this point in the history
  • Loading branch information
blorbb committed Jan 4, 2022
1 parent 9ebbb6f commit 596d7ef
Show file tree
Hide file tree
Showing 2 changed files with 184 additions and 7 deletions.
48 changes: 41 additions & 7 deletions theming/_mapColors.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ const lightGray = {
'board-card': 'rgba(60, 65, 68, 0.7)',
'board-card_text': 'inherit',
'board-text': 'rgba(107, 112, 116, 0.7)',
}
},
};
// TODO also add colouring for the preview box?


const colors = {
'gray': {
'light': {
Expand Down Expand Up @@ -293,7 +292,10 @@ function css() {
notCallout = ":not([style*='border-radius'])",
notBoardCard = ":not([style*='box-shadow'])",
isTag =
"[style*='align-items: center;'][style*='border-radius: 3px; padding-left: 6px;'][style*='line-height: 120%;']";
"[style*='align-items: center;'][style*='border-radius: 3px; padding-left: 6px;'][style*='line-height: 120%;']",
isTagPalette = "[style*='border-radius: 3px;'][style*='width: 18px; height: 18px;']",
isHighlightPalette =
"[style*='align-items: center; justify-content: center; width: 22px; height: 22px;'][style*='border-radius: 3px; font-weight: 500;']";
let css = '';

// generate light gray separately
Expand All @@ -307,6 +309,16 @@ function css() {
color: var(--theme--tag_light-gray-text) !important;
}
.notion-body:not(.dark) [style*='background: ${
lightGray.light['tag']
}']${isTagPalette},
.notion-body.dark [style*='background: ${
lightGray.dark['board-text']
}']${isTagPalette} {
background: var(--theme--tag_light-gray) !important;
color: var(--theme--tag_light-gray-text) !important;
}
.notion-body:not(.dark)
.notion-board-group[style*='background-color: ${lightGray.light['board']}'],
.notion-body.dark
Expand Down Expand Up @@ -415,6 +427,25 @@ function css() {
color: var(--theme--tag_${c}-text) !important;
}
.notion-body:not(.dark) [style*='background: ${
colors[c].light['callout']
}']${isHighlightPalette},
.notion-body.dark [style*='background: ${
colors[c].dark['callout']
}']${isHighlightPalette} {
background: var(--theme--highlight_${c}) !important;
color: var(--theme--highlight_${c}-text) !important;
}
.notion-body:not(.dark) [style*='background: ${
colors[c].light['tag']
}']${isTagPalette},
.notion-body.dark [style*='background: ${
colors[c].dark['board-text']
}']${isTagPalette} {
background: var(--theme--tag_${c}) !important;
color: var(--theme--tag_${c}-text) !important;
}
.notion-body:not(.dark)
.notion-board-group[style*='background-color: ${colors[c].light['board']}'],
.notion-body.dark
Expand Down Expand Up @@ -452,10 +483,14 @@ function css() {
}
.notion-body:not(.dark) .notion-board-view
[style*='color: ${colors[c].light['board-text']}'],
.notion-body.dark .notion-board-view [style*='color: ${colors[c].dark['board-text']}'],
.notion-body.dark .notion-board-view [style*='color: ${
colors[c].dark['board-text']
}'],
.notion-body:not(.dark) .notion-board-view
[style*='fill: ${colors[c].light['board-text']}'],
.notion-body.dark .notion-board-view [style*='fill: ${colors[c].dark['board-text']}'] {
.notion-body.dark .notion-board-view [style*='fill: ${
colors[c].dark['board-text']
}'] {
color: var(--theme--board_${c}-text) !important;
fill: var(--theme--board_${c}-text) !important;
}
Expand All @@ -467,7 +502,7 @@ function css() {
// 'light' or 'dark'
function vars(mode) {
// add the prefixes that light gray doesn't have first to preserve the same order
const sets = {'text': '', 'highlight': '', 'callout': ''};
const sets = { text: '', highlight: '', callout: '' };

// light gray separately
for (let key in lightGray[mode]) {
Expand Down Expand Up @@ -502,4 +537,3 @@ if (process.argv.includes('css')) {
} else if (process.argv.includes('dark')) {
console.log(vars('dark'));
}

143 changes: 143 additions & 0 deletions theming/colors.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
color: var(--theme--tag_light-gray-text) !important;
}

.notion-body:not(.dark)
[style*='background: rgba(227, 226, 224, 0.5)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'],
.notion-body.dark
[style*='background: rgba(107, 112, 116, 0.7)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'] {
background: var(--theme--tag_light-gray) !important;
color: var(--theme--tag_light-gray-text) !important;
}

.notion-body:not(.dark)
.notion-board-group[style*='background-color: rgba(249, 249, 245, 0.5)'],
.notion-body.dark .notion-board-group[style*='background-color: rgba(51, 55, 59, 0.7)'],
Expand Down Expand Up @@ -125,6 +133,21 @@
color: var(--theme--tag_gray-text) !important;
}

.notion-body:not(.dark)
[style*='background: rgb(241, 241, 239)'][style*='align-items: center; justify-content: center; width: 22px; height: 22px;'][style*='border-radius: 3px; font-weight: 500;'],
.notion-body.dark
[style*='background: rgb(60, 65, 68)'][style*='align-items: center; justify-content: center; width: 22px; height: 22px;'][style*='border-radius: 3px; font-weight: 500;'] {
background: var(--theme--highlight_gray) !important;
color: var(--theme--highlight_gray-text) !important;
}
.notion-body:not(.dark)
[style*='background: rgb(227, 226, 224)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'],
.notion-body.dark
[style*='background: rgb(107, 112, 116)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'] {
background: var(--theme--tag_gray) !important;
color: var(--theme--tag_gray-text) !important;
}

.notion-body:not(.dark)
.notion-board-group[style*='background-color: rgba(247, 247, 245, 0.7)'],
.notion-body.dark .notion-board-group[style*='background-color: rgb(51, 55, 59)'],
Expand Down Expand Up @@ -236,6 +259,21 @@
color: var(--theme--tag_brown-text) !important;
}

.notion-body:not(.dark)
[style*='background: rgb(244, 238, 238)'][style*='align-items: center; justify-content: center; width: 22px; height: 22px;'][style*='border-radius: 3px; font-weight: 500;'],
.notion-body.dark
[style*='background: rgb(76, 61, 53)'][style*='align-items: center; justify-content: center; width: 22px; height: 22px;'][style*='border-radius: 3px; font-weight: 500;'] {
background: var(--theme--highlight_brown) !important;
color: var(--theme--highlight_brown-text) !important;
}
.notion-body:not(.dark)
[style*='background: rgb(238, 224, 218)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'],
.notion-body.dark
[style*='background: rgb(155, 98, 69)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'] {
background: var(--theme--tag_brown) !important;
color: var(--theme--tag_brown-text) !important;
}

.notion-body:not(.dark)
.notion-board-group[style*='background-color: rgba(250, 246, 245, 0.7)'],
.notion-body.dark .notion-board-group[style*='background-color: rgb(59, 54, 51)'],
Expand Down Expand Up @@ -347,6 +385,21 @@
color: var(--theme--tag_orange-text) !important;
}

.notion-body:not(.dark)
[style*='background: rgb(251, 236, 221)'][style*='align-items: center; justify-content: center; width: 22px; height: 22px;'][style*='border-radius: 3px; font-weight: 500;'],
.notion-body.dark
[style*='background: rgb(85, 59, 41)'][style*='align-items: center; justify-content: center; width: 22px; height: 22px;'][style*='border-radius: 3px; font-weight: 500;'] {
background: var(--theme--highlight_orange) !important;
color: var(--theme--highlight_orange-text) !important;
}
.notion-body:not(.dark)
[style*='background: rgb(250, 222, 201)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'],
.notion-body.dark
[style*='background: rgb(168, 92, 30)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'] {
background: var(--theme--tag_orange) !important;
color: var(--theme--tag_orange-text) !important;
}

.notion-body:not(.dark)
.notion-board-group[style*='background-color: rgba(252, 245, 242, 0.7)'],
.notion-body.dark .notion-board-group[style*='background-color: rgb(61, 54, 49)'],
Expand Down Expand Up @@ -458,6 +511,21 @@
color: var(--theme--tag_yellow-text) !important;
}

.notion-body:not(.dark)
[style*='background: rgb(251, 243, 219)'][style*='align-items: center; justify-content: center; width: 22px; height: 22px;'][style*='border-radius: 3px; font-weight: 500;'],
.notion-body.dark
[style*='background: rgb(79, 64, 41)'][style*='align-items: center; justify-content: center; width: 22px; height: 22px;'][style*='border-radius: 3px; font-weight: 500;'] {
background: var(--theme--highlight_yellow) !important;
color: var(--theme--highlight_yellow-text) !important;
}
.notion-body:not(.dark)
[style*='background: rgb(253, 236, 200)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'],
.notion-body.dark
[style*='background: rgb(137, 107, 42)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'] {
background: var(--theme--tag_yellow) !important;
color: var(--theme--tag_yellow-text) !important;
}

.notion-body:not(.dark)
.notion-board-group[style*='background-color: rgba(250, 247, 237, 0.7)'],
.notion-body.dark .notion-board-group[style*='background-color: rgb(56, 55, 49)'],
Expand Down Expand Up @@ -569,6 +637,21 @@
color: var(--theme--tag_green-text) !important;
}

.notion-body:not(.dark)
[style*='background: rgb(237, 243, 236)'][style*='align-items: center; justify-content: center; width: 22px; height: 22px;'][style*='border-radius: 3px; font-weight: 500;'],
.notion-body.dark
[style*='background: rgb(46, 68, 58)'][style*='align-items: center; justify-content: center; width: 22px; height: 22px;'][style*='border-radius: 3px; font-weight: 500;'] {
background: var(--theme--highlight_green) !important;
color: var(--theme--highlight_green-text) !important;
}
.notion-body:not(.dark)
[style*='background: rgb(219, 237, 219)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'],
.notion-body.dark
[style*='background: rgb(61, 124, 86)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'] {
background: var(--theme--tag_green) !important;
color: var(--theme--tag_green-text) !important;
}

.notion-body:not(.dark)
.notion-board-group[style*='background-color: rgba(244, 248, 243, 0.7)'],
.notion-body.dark .notion-board-group[style*='background-color: rgb(49, 57, 53)'],
Expand Down Expand Up @@ -680,6 +763,21 @@
color: var(--theme--tag_blue-text) !important;
}

.notion-body:not(.dark)
[style*='background: rgb(231, 243, 248)'][style*='align-items: center; justify-content: center; width: 22px; height: 22px;'][style*='border-radius: 3px; font-weight: 500;'],
.notion-body.dark
[style*='background: rgb(45, 66, 86)'][style*='align-items: center; justify-content: center; width: 22px; height: 22px;'][style*='border-radius: 3px; font-weight: 500;'] {
background: var(--theme--highlight_blue) !important;
color: var(--theme--highlight_blue-text) !important;
}
.notion-body:not(.dark)
[style*='background: rgb(211, 229, 239)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'],
.notion-body.dark
[style*='background: rgb(46, 117, 164)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'] {
background: var(--theme--tag_blue) !important;
color: var(--theme--tag_blue-text) !important;
}

.notion-body:not(.dark)
.notion-board-group[style*='background-color: rgba(241, 248, 251, 0.7)'],
.notion-body.dark .notion-board-group[style*='background-color: rgb(49, 56, 64)'],
Expand Down Expand Up @@ -791,6 +889,21 @@
color: var(--theme--tag_purple-text) !important;
}

.notion-body:not(.dark)
[style*='background: rgba(244, 240, 247, 0.8)'][style*='align-items: center; justify-content: center; width: 22px; height: 22px;'][style*='border-radius: 3px; font-weight: 500;'],
.notion-body.dark
[style*='background: rgb(69, 58, 91)'][style*='align-items: center; justify-content: center; width: 22px; height: 22px;'][style*='border-radius: 3px; font-weight: 500;'] {
background: var(--theme--highlight_purple) !important;
color: var(--theme--highlight_purple-text) !important;
}
.notion-body:not(.dark)
[style*='background: rgb(232, 222, 238)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'],
.notion-body.dark
[style*='background: rgb(123, 96, 180)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'] {
background: var(--theme--tag_purple) !important;
color: var(--theme--tag_purple-text) !important;
}

.notion-body:not(.dark)
.notion-board-group[style*='background-color: rgba(249, 246, 252, 0.7)'],
.notion-body.dark .notion-board-group[style*='background-color: rgb(57, 53, 65)'],
Expand Down Expand Up @@ -902,6 +1015,21 @@
color: var(--theme--tag_pink-text) !important;
}

.notion-body:not(.dark)
[style*='background: rgba(249, 238, 243, 0.8)'][style*='align-items: center; justify-content: center; width: 22px; height: 22px;'][style*='border-radius: 3px; font-weight: 500;'],
.notion-body.dark
[style*='background: rgb(81, 56, 77)'][style*='align-items: center; justify-content: center; width: 22px; height: 22px;'][style*='border-radius: 3px; font-weight: 500;'] {
background: var(--theme--highlight_pink) !important;
color: var(--theme--highlight_pink-text) !important;
}
.notion-body:not(.dark)
[style*='background: rgb(245, 224, 233)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'],
.notion-body.dark
[style*='background: rgb(169, 76, 157)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'] {
background: var(--theme--tag_pink) !important;
color: var(--theme--tag_pink-text) !important;
}

.notion-body:not(.dark)
.notion-board-group[style*='background-color: rgba(251, 245, 251, 0.7)'],
.notion-body.dark .notion-board-group[style*='background-color: rgb(60, 53, 58)'],
Expand Down Expand Up @@ -1013,6 +1141,21 @@
color: var(--theme--tag_red-text) !important;
}

.notion-body:not(.dark)
[style*='background: rgb(253, 235, 236)'][style*='align-items: center; justify-content: center; width: 22px; height: 22px;'][style*='border-radius: 3px; font-weight: 500;'],
.notion-body.dark
[style*='background: rgb(94, 52, 54)'][style*='align-items: center; justify-content: center; width: 22px; height: 22px;'][style*='border-radius: 3px; font-weight: 500;'] {
background: var(--theme--highlight_red) !important;
color: var(--theme--highlight_red-text) !important;
}
.notion-body:not(.dark)
[style*='background: rgb(255, 226, 221)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'],
.notion-body.dark
[style*='background: rgb(194, 65, 82)'][style*='border-radius: 3px;'][style*='width: 18px; height: 18px;'] {
background: var(--theme--tag_red) !important;
color: var(--theme--tag_red-text) !important;
}

.notion-body:not(.dark)
.notion-board-group[style*='background-color: rgba(253, 245, 243, 0.7)'],
.notion-body.dark .notion-board-group[style*='background-color: rgb(66, 51, 51)'],
Expand Down

0 comments on commit 596d7ef

Please sign in to comment.