Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用不透明的颜色来表示高亮,将叠加高亮的颜色统一 #42

Merged
merged 2 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 38 additions & 19 deletions app/appearance/themes/daylight/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
--b3-theme-on-primary: #fff;
--b3-theme-on-secondary: #fff;
--b3-theme-on-background: #222;
--b3-theme-on-background-rgba: rgb(34, 34, 34, .86);
--b3-theme-on-background-select: rgb(36, 44, 59);
--b3-theme-on-surface: #5f6368;
--b3-theme-on-surface-light: rgba(95, 99, 104, .68);
--b3-theme-on-error: #fff;
Expand Down Expand Up @@ -73,16 +73,20 @@
/* 卡片背景 */
--b3-card-error-color: rgb(97, 26, 21);
--b3-card-error-background: #f5d1cf;
--b3-card-error-background-rgba: rgb(245, 209, 207, .86);
--b3-card-error-background-select: rgb(222, 198, 211);
--b3-card-error-background-select-double: rgb(202, 188, 214);
--b3-card-warning-color: rgb(102, 60, 0);
--b3-card-warning-background: #ffe8c8;
--b3-card-warning-background-rgba: rgb(255, 232, 200, .86);
--b3-card-warning-background-select: rgb(231, 218, 205);
--b3-card-warning-background-select-double: rgb(210, 206, 209);
--b3-card-info-color: rgb(13, 60, 97);
--b3-card-info-background: #d6eaf9;
--b3-card-info-background-rgba: rgb(214, 234, 249, .86);
--b3-card-info-background-select: rgb(195, 220, 248);
--b3-card-info-background-select-double: rgb(178, 208, 247);
--b3-card-success-color: rgb(30, 70, 32);
--b3-card-success-background: #d7eed8;
--b3-card-success-background-rgba: rgb(215, 238, 216, .86);
--b3-card-success-background-select: rgb(196, 223, 219);
--b3-card-success-background-select-double: rgb(179, 210, 222);

/* 自定义文字 */
--b3-font-color1: var(--b3-card-error-color);
Expand Down Expand Up @@ -111,19 +115,34 @@
--b3-font-background11: #def0d9;
--b3-font-background12: #fae3e4;
--b3-font-background13: var(--b3-theme-on-background);
--b3-font-background1-rgba: var(--b3-card-error-background-rgba);
--b3-font-background2-rgba: var(--b3-card-warning-background-rgba);
--b3-font-background3-rgba: var(--b3-card-info-background-rgba);
--b3-font-background4-rgba: var(--b3-card-success-background-rgba);
--b3-font-background5-rgba: rgb(226, 227, 228, .86);
--b3-font-background6-rgba: rgb(172, 208, 252, .86);
--b3-font-background7-rgba: rgb(253, 238, 214, .86);
--b3-font-background8-rgba: rgb(250, 225, 207, .86);
--b3-font-background9-rgba: rgb(253, 213, 231, .86);
--b3-font-background10-rgba: rgb(230, 199, 230, .86);
--b3-font-background11-rgba: rgb(222, 240, 217, .86);
--b3-font-background12-rgba: rgb(250, 227, 228, .86);
--b3-font-background13-rgba: var(--b3-theme-on-background-rgba);
/* -select 是块的背景色与 --b3-theme-primary-lightest 混合后的颜色 */
--b3-font-background1-select: var(--b3-card-error-background-select);
--b3-font-background2-select: var(--b3-card-warning-background-select);
--b3-font-background3-select: var(--b3-card-info-background-select);
--b3-font-background4-select: var(--b3-card-success-background-select);
--b3-font-background5-select: rgb(205, 214, 229);
--b3-font-background6-select: rgb(158, 197, 251);
--b3-font-background7-select: rgb(229, 223, 217);
--b3-font-background8-select: rgb(226, 212, 211);
--b3-font-background9-select: rgb(229, 201, 232);
--b3-font-background10-select: rgb(209, 189, 231);
--b3-font-background11-select: rgb(202, 225, 220);
--b3-font-background12-select: rgb(226, 214, 229);
--b3-font-background13-select: var(--b3-theme-on-background-select);
/* -select-double 是 -select 与 --b3-theme-primary-lightest 再次混合后的颜色 */
--b3-font-background1-select-double: var(--b3-card-error-background-select-double);
--b3-font-background2-select-double: var(--b3-card-warning-background-select-double);
--b3-font-background3-select-double: var(--b3-card-info-background-select-double);
--b3-font-background4-select-double: var(--b3-card-success-background-select-double);
--b3-font-background5-select-double: rgb(187, 202, 230);
--b3-font-background6-select-double: rgb(145, 187, 250);
--b3-font-background7-select-double: rgb(208, 210, 220);
--b3-font-background8-select-double: rgb(205, 201, 214);
--b3-font-background9-select-double: rgb(208, 191, 233);
--b3-font-background10-select-double: rgb(190, 180, 232);
--b3-font-background11-select-double: rgb(184, 212, 222);
--b3-font-background12-select-double: rgb(205, 202, 230);
--b3-font-background13-select-double: rgb(38, 53, 81);

/* 动画效果 */
--b3-transition: all .2s cubic-bezier(0, 0, .2, 1) 0ms;
Expand Down Expand Up @@ -197,7 +216,7 @@
/* 表格 */
--b3-table-even-background: rgba(0, 0, 0, .02);

/* 潜入块 */
/* 嵌入块 */
--b3-embed-background: var(--b3-table-even-background);

/* 引述块 */
Expand Down
57 changes: 38 additions & 19 deletions app/appearance/themes/midnight/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
--b3-theme-on-primary: #fff;
--b3-theme-on-secondary: #fff;
--b3-theme-on-background: #dadada;
--b3-theme-on-background-rgba: rgb(218, 218, 218, 0.86);
--b3-theme-on-background-select: rgb(198, 206, 221);
--b3-theme-on-surface: #9aa0a6;
--b3-theme-on-surface-light: #bababa;
--b3-theme-on-error: #fff;
Expand Down Expand Up @@ -72,16 +72,20 @@
/* 卡片背景 */
--b3-card-error-color: rgb(243, 153, 147);
--b3-card-error-background: #442724;
--b3-card-error-background-rgba: rgb(68, 39, 36, 0.86);
--b3-card-error-background-select: rgb(66, 48, 60);
--b3-card-error-background-select-double: rgb(64, 56, 82);
--b3-card-warning-color: rgb(255, 213, 153);
--b3-card-warning-background: #554636;
--b3-card-warning-background-rgba: rgb(85, 70, 54, 0.86);
--b3-card-warning-background-select: rgb(81, 76, 76);
--b3-card-warning-background-select-double: rgb(78, 81, 96);
--b3-card-info-color: rgb(166, 213, 250);
--b3-card-info-background: #28405c;
--b3-card-info-background-rgba: rgb(40, 64, 92, 0.86);
--b3-card-info-background-select: rgb(42, 70, 110);
--b3-card-info-background-select-double: rgb(43, 76, 126);
--b3-card-success-color: rgb(183, 223, 185);
--b3-card-success-background: #425347;
--b3-card-success-background-rgba: rgb(66, 83, 71, 0.86);
--b3-card-success-background-select: rgb(64, 87, 91);
--b3-card-success-background-select-double: rgb(63, 91, 109);

/* 自定义文字 */
--b3-font-color1: var(--b3-card-error-color);
Expand Down Expand Up @@ -110,19 +114,34 @@
--b3-font-background11: #376629;
--b3-font-background12: #803a06;
--b3-font-background13: var(--b3-theme-on-background);
--b3-font-background1-rgba: var(--b3-card-error-background-rgba);
--b3-font-background2-rgba: var(--b3-card-warning-background-rgba);
--b3-font-background3-rgba: var(--b3-card-info-background-rgba);
--b3-font-background4-rgba: var(--b3-card-success-background-rgba);
--b3-font-background5-rgba: rgb(76, 82, 87, 0.86);
--b3-font-background6-rgba: rgb(12, 61, 136, 0.86);
--b3-font-background7-rgba: rgb(89, 57, 5, 0.86);
--b3-font-background8-rgba: rgb(84, 24, 18, 0.86);
--b3-font-background9-rgba: rgb(106, 6, 52, 0.86);
--b3-font-background10-rgba: rgb(107, 47, 107, 0.86);
--b3-font-background11-rgba: rgb(55, 102, 41, 0.86);
--b3-font-background12-rgba: rgb(128, 58, 6, 0.86);
--b3-font-background13-rgba: var(--b3-theme-on-background-rgba);
/* -select 是块的背景色与 --b3-theme-primary-lightest 混合后的颜色 */
--b3-font-background1-select: var(--b3-card-error-background-select);
--b3-font-background2-select: var(--b3-card-warning-background-select);
--b3-font-background3-select: var(--b3-card-info-background-select);
--b3-font-background4-select: var(--b3-card-success-background-select);
--b3-font-background5-select: rgb(73, 86, 105);
--b3-font-background6-select: rgb(17, 68, 148);
--b3-font-background7-select: rgb(85, 64, 33);
--b3-font-background8-select: rgb(80, 35, 45);
--b3-font-background9-select: rgb(100, 19, 75);
--b3-font-background10-select: rgb(101, 55, 123);
--b3-font-background11-select: rgb(55, 104, 65);
--b3-font-background12-select: rgb(119, 65, 34);
--b3-font-background13-select: var(--b3-theme-on-background-select);
/* -select-double 是 -select 与 --b3-theme-primary-lightest 再次混合后的颜色 */
--b3-font-background1-select-double: var(--b3-card-error-background-select-double);
--b3-font-background2-select-double: var(--b3-card-warning-background-select-double);
--b3-font-background3-select-double: var(--b3-card-info-background-select-double);
--b3-font-background4-select-double: var(--b3-card-success-background-select-double);
--b3-font-background5-select-double: rgb(71, 90, 121);
--b3-font-background6-select-double: rgb(21, 74, 159);
--b3-font-background7-select-double: rgb(81, 70, 58);
--b3-font-background8-select-double: rgb(77, 45, 68);
--b3-font-background9-select-double: rgb(94, 31, 95);
--b3-font-background10-select-double: rgb(95, 62, 137);
--b3-font-background11-select-double: rgb(55, 106, 86);
--b3-font-background12-select-double: rgb(111, 71, 59);
--b3-font-background13-select-double: rgb(181, 195, 223);

/* 动画效果 */
--b3-transition: all .2s cubic-bezier(0, 0, .2, 1) 0ms;
Expand Down Expand Up @@ -196,7 +215,7 @@
/* 表格 */
--b3-table-even-background: rgba(255, 255, 255, .03);

/* 潜入块 */
/* 嵌入块 */
--b3-embed-background: var(--b3-table-even-background);

/* 引述块 */
Expand Down
108 changes: 55 additions & 53 deletions app/src/assets/scss/protyle/_wysiwyg.scss
Original file line number Diff line number Diff line change
Expand Up @@ -464,57 +464,64 @@

&--select {
background-color: var(--b3-theme-primary-lightest) !important;
}
&--hl {
transition: var(--b3-background-transition);
background-color: var(--b3-theme-primary-lightest) !important;

[data-node-id][style*="background-color: var(--b3-font-background1)"] {
background-color: var(--b3-font-background1-rgba) !important;
}

[data-node-id][style*="background-color: var(--b3-font-background2)"] {
background-color: var(--b3-font-background2-rgba) !important;
}

[data-node-id][style*="background-color: var(--b3-font-background3)"] {
background-color: var(--b3-font-background3-rgba) !important;
}

[data-node-id][style*="background-color: var(--b3-font-background4)"] {
background-color: var(--b3-font-background4-rgba) !important;
}

[data-node-id][style*="background-color: var(--b3-font-background5)"] {
background-color: var(--b3-font-background5-rgba) !important;
}

[data-node-id][style*="background-color: var(--b3-font-background6)"] {
background-color: var(--b3-font-background6-rgba) !important;
}

[data-node-id][style*="background-color: var(--b3-font-background7)"] {
background-color: var(--b3-font-background7-rgba) !important;
}

[data-node-id][style*="background-color: var(--b3-font-background8)"] {
background-color: var(--b3-font-background8-rgba) !important;
}

[data-node-id][style*="background-color: var(--b3-font-background9)"] {
background-color: var(--b3-font-background9-rgba) !important;
}

[data-node-id][style*="background-color: var(--b3-font-background10)"] {
background-color: var(--b3-font-background10-rgba) !important;
}

[data-node-id][style*="background-color: var(--b3-font-background11)"] {
background-color: var(--b3-font-background11-rgba) !important;
}
[data-node-id],
&[data-node-id] {
transition: var(--b3-background-transition);
}
}

[data-node-id][style*="background-color: var(--b3-font-background12)"] {
background-color: var(--b3-font-background12-rgba) !important;
}
$backgrounds: (
"font-background": 13,
"card-error-background": 1,
"card-warning-background": 1,
"card-info-background": 1,
"card-success-background": 1,
);
@each $key, $count in $backgrounds {
@for $i from 1 through $count {
$bg-variable: if($count == 1, var(--b3-#{$key}), var(--b3-#{$key}#{$i}));
$bg-select-variable: if($count == 1, var(--b3-#{$key}-select), var(--b3-#{$key}#{$i}-select));
$bg-select-double-variable: if($count == 1, var(--b3-#{$key}-select-double), var(--b3-#{$key}#{$i}-select-double));

[data-node-id][style*="background-color: var(--b3-font-background13)"] {
background-color: var(--b3-font-background13-rgba) !important;
&--select {
[data-node-id],
&[data-node-id] {
&[style*="background-color: #{$bg-variable}"] {
background-color: #{$bg-select-variable} !important;
}
}
// 叠加两层高亮
.protyle-wysiwyg--hl {
[data-node-id],
&[data-node-id] {
&[style*="background-color: #{$bg-variable}"] {
background-color: #{$bg-select-double-variable} !important;
}
}
}
}
&--hl {
[data-node-id],
&[data-node-id] {
&[style*="background-color: #{$bg-variable}"] {
background-color: #{$bg-select-variable} !important;
}
}
// 叠加两层高亮
.protyle-wysiwyg--select {
[data-node-id],
&[data-node-id] {
&[style*="background-color: #{$bg-variable}"] {
background-color: #{$bg-select-double-variable} !important;
}
}
}
}
}
}

Expand All @@ -523,11 +530,6 @@
display: none;
}

&--hl {
transition: var(--b3-background-transition);
background-color: var(--b3-theme-primary-lightest) !important;
}

.dragover {
&__top:not(.av__row) {
box-shadow: 0 -4px 0 0 var(--b3-theme-primary-lighter) !important;
Expand Down
Loading