Skip to content

Commit beaa59f

Browse files
committed
Improve the appearance of Copy Code
1 parent cedac7d commit beaa59f

7 files changed

Lines changed: 339 additions & 387 deletions

File tree

dist/lite/markedit-preview.js

Lines changed: 35 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/markedit-preview.js

Lines changed: 290 additions & 304 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/render.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export async function applyStyles(html: string) {
6767
stylify(coreCss(styledHtmlColorScheme)),
6868
stylify(previewThemeCss(styledHtmlColorScheme)),
6969
stylify(alertsCss(styledHtmlColorScheme)),
70-
stylify(codeCopyCss(styledHtmlColorScheme)),
70+
stylify(codeCopyCss()),
7171
'</body></html>',
7272
];
7373

src/styling.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ import hljsBase from '../styles/hljs/base.css?raw';
2929
import hljsDark from '../styles/hljs/dark.css?raw';
3030

3131
import codeCopyBase from '../styles/code-copy/base.css?raw';
32-
import codeCopyLight from '../styles/code-copy/light.css?raw';
33-
import codeCopyDark from '../styles/code-copy/dark.css?raw';
3432

3533
export type PreviewTheme = typeof previewThemeNames[number];
3634

@@ -116,13 +114,8 @@ export function hljsCss(colorScheme: ColorScheme = 'auto') {
116114
return createCss(colorScheme, hljsBase, hljsDark).join('\n');
117115
}
118116

119-
export function codeCopyCss(colorScheme: ColorScheme = 'auto') {
120-
const styles = [
121-
codeCopyBase,
122-
...createCss(colorScheme, codeCopyLight, codeCopyDark),
123-
];
124-
125-
return styles.join('\n');
117+
export function codeCopyCss() {
118+
return codeCopyBase;
126119
}
127120

128121
function createCss(colorScheme: ColorScheme, lightCss: string, darkCss: string): string[] {

styles/code-copy/base.css

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,20 @@
88
right: 6px;
99
opacity: 0;
1010
transition: opacity 0.2s, background 0.2s;
11-
border: none;
11+
border: 1px solid var(--borderColor-default, ButtonBorder);
1212
border-radius: 8px;
1313
padding: 6px 7px;
14-
background: none;
14+
background: var(--bgColor-muted, Canvas);
15+
color: var(--fgColor-muted, GrayText);
1516

1617
/* Prevent elements from moving during opacity changes in Safari */
1718
will-change: opacity, background;
1819
}
20+
21+
.code-copy-button:hover {
22+
background: var(--bgColor-neutral-muted, ButtonFace);
23+
}
24+
25+
.code-copy-button:active {
26+
background: var(--borderColor-default, ButtonBorder);
27+
}

styles/code-copy/dark.css

Lines changed: 0 additions & 11 deletions
This file was deleted.

styles/code-copy/light.css

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)