Pop-up dictionary browser extension for language learning. Successor to Yomichan. (PERSONAL FORK)
1/*
2 * Copyright (C) 2023-2025 Yomitan Authors
3 * Copyright (C) 2020-2022 Yomichan Authors
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
19/* Variables */
20:root {
21 --search-scroll-container-horizontal-padding: 0.72em;
22 --query-horizontal-padding: 0;
23
24 --padding: calc(10em / var(--font-size-no-units));
25 --content-width-search: 700;
26 --content-width: calc(1em * var(--content-width-search) / var(--font-size-no-units));
27
28 --background-color: #ffffff;
29 --separator-color1: #cccccc;
30
31 --search-textbox-height: calc(var(--textarea-line-height) + var(--textarea-padding) * 2);
32 --search-textbox-min-height: calc(var(--textarea-line-height) + var(--textarea-padding) * 2);
33 --search-textbox-max-height: calc(var(--textarea-line-height) * 5 + var(--textarea-padding) * 2);
34
35 --cog-icon-size: 26px;
36}
37:root:not([data-loaded=true]) {
38 --animation-duration: 0s;
39}
40:root[data-theme=dark] {
41 --separator-color1: #333333;
42}
43
44/* Common styles */
45:root {
46 height: 100%;
47}
48body {
49 background-color: var(--background-color);
50 margin: 0;
51 padding: 0;
52 color: var(--text-color);
53 height: 100%;
54 overflow: hidden;
55}
56.search-header {
57 padding-left: var(--search-scroll-container-horizontal-padding);
58 padding-right: var(--search-scroll-container-horizontal-padding);
59}
60h1 {
61 font-size: 2em;
62 line-height: 1.5em;
63 margin: 0;
64 padding: 0.25em 0 0;
65 font-weight: normal;
66 box-sizing: border-box;
67 border-bottom: calc(1em / (var(--font-size-no-units) * 2)) solid var(--separator-color1);
68}
69
70/* Search bar */
71.search-textbox-container {
72 display: flex;
73 flex-flow: row nowrap;
74 width: 100%;
75 align-items: center;
76 margin: 0;
77 padding: 0;
78 border: 0;
79}
80#search-textbox {
81 color: var(--text-color);
82 flex: 1 1 auto;
83 box-sizing: border-box;
84 padding: var(--textarea-padding);
85 background-color: var(--input-background-color);
86 border-radius: 0;
87 line-height: var(--textarea-line-height);
88 border: 0;
89 outline: none;
90 width: 100%;
91 height: var(--search-textbox-height);
92 min-height: var(--search-textbox-min-height);
93 max-height: var(--search-textbox-max-height);
94 resize: none;
95 font-size: var(--font-size);
96 font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
97 white-space: pre-wrap;
98 z-index: 1;
99}
100.search-button {
101 flex: 0 0 auto;
102 position: relative;
103 width: 2.5em;
104 height: var(--search-textbox-height);
105 min-height: var(--search-textbox-min-height);
106 max-height: var(--search-textbox-max-height);
107 background-color: var(--input-background-color);
108 border: 0;
109 padding: 0;
110 margin: 0;
111 cursor: pointer;
112 outline: none;
113 transition: background-color var(--animation-duration) ease-in-out;
114 border-radius: 0;
115}
116.search-button:hover,
117.search-button:focus {
118 background-color: var(--input-background-color-dark);
119}
120.search-button:focus:not(:focus-visible):not(:hover) {
121 background-color: var(--input-background-color);
122}
123.search-button:focus-visible {
124 background-color: var(--input-background-color-dark);
125}
126.search-button:active,
127.search-button:active:focus {
128 background-color: var(--input-background-color-darker);
129}
130
131.search-button>.icon {
132 display: block;
133 position: absolute;
134 left: 0;
135 top: 0;
136 right: 0;
137 bottom: 0;
138 background-color: var(--button-default-icon-color);
139 --icon-size: 16px 16px;
140}
141
142.clear-button {
143 flex: 0 0 auto;
144 position: relative;
145 width: 2.5em;
146 height: var(--search-textbox-height);
147 min-height: var(--search-textbox-min-height);
148 max-height: var(--search-textbox-max-height);
149 background-color: var(--input-background-color);
150 border: 0;
151 padding: 0;
152 margin: 0;
153 cursor: pointer;
154 outline: none;
155 transition: background-color var(--animation-duration) ease-in-out;
156 border-radius: 0;
157}
158.clear-button:hover,
159.clear-button:focus {
160 background-color: var(--input-background-color-dark);
161}
162.clear-button:focus:not(:focus-visible):not(:hover) {
163 background-color: var(--input-background-color);
164}
165.clear-button:focus-visible {
166 background-color: var(--input-background-color-dark);
167}
168.clear-button:active,
169.clear-button:active:focus {
170 background-color: var(--input-background-color-darker);
171}
172
173.clear-button>.icon {
174 display: block;
175 position: absolute;
176 left: 0;
177 top: 0;
178 right: 0;
179 bottom: 0;
180 background-color: var(--button-default-icon-color);
181 --icon-size: 16px 16px;
182}
183
184/* Search options */
185#search-settings-button>.icon {
186 display: block;
187 background-color: var(--button-default-icon-color);
188 width: var(--cog-icon-size);
189 height: var(--cog-icon-size);
190 transition: var(--animation-duration) filter ease-in-out;
191}
192#search-settings-button>.icon:hover,
193#search-settings-button>.icon:focus {
194 filter: invert(0.5);
195}
196#search-settings-button {
197 margin-right: 0;
198 float: right;
199}
200.search-options-right {
201 flex: 1;
202}
203.search-options {
204 display: flex;
205 flex-flow: row wrap;
206 margin: 0.5em 0 0 0;
207 align-items: center;
208}
209.search-option {
210 flex: 0 1 auto;
211 margin: 0.5em 2em 0.5em 0;
212 align-items: center;
213 cursor: pointer;
214}
215.search-option:not([hidden]) {
216 display: flex;
217}
218.search-option-label {
219 padding-left: 0.5em;
220}
221
222/* Search styles */
223#intro {
224 overflow: hidden;
225}
226#intro>p {
227 margin: 0;
228}
229:root[data-search-mode=action-popup] #intro,
230:root[data-search-mode=action-popup] #search-option-clipboard-monitor-container {
231 display: none;
232}
233:root[data-search-mode=action-popup],
234:root[data-search-mode=action-popup] body {
235 width: 640px;
236 height: 480px;
237}
238
239/* Dark mode before themes are applied
240 DO NOT use this for normal theming */
241@media (prefers-color-scheme: dark) {
242 :root:not([data-loaded=true]) {
243 background-color: #1e1e1e;
244 }
245}