File tree Expand file tree Collapse file tree 4 files changed +70
-7
lines changed Expand file tree Collapse file tree 4 files changed +70
-7
lines changed Original file line number Diff line number Diff line change @@ -49,13 +49,20 @@ function Refresh() {
49
49
)
50
50
}
51
51
52
- function Open ( { href } : { href : string } ) {
52
+ function Open ( {
53
+ href,
54
+ style,
55
+ } : {
56
+ href : string
57
+ style ?: React . CSSProperties
58
+ } ) {
53
59
const c = useClasser ( "ch-browser" )
54
60
return (
55
61
< a
56
62
className = { c ( "button" , "open-button" ) }
57
63
title = "Open in new tab"
58
64
href = { href }
65
+ style = { style }
59
66
target = "_blank"
60
67
rel = "noopener noreferrer"
61
68
>
Original file line number Diff line number Diff line change 1
1
import React from "react"
2
2
import { Back , Forward , Open } from "./buttons"
3
3
import { FrameButtons } from "@code-hike/mini-frame"
4
- import { EditorTheme } from "@code-hike/utils"
4
+ import {
5
+ EditorTheme ,
6
+ getColor ,
7
+ ColorName ,
8
+ } from "@code-hike/utils"
5
9
6
10
export { TitleBar }
7
11
@@ -14,14 +18,36 @@ function TitleBar({
14
18
linkUrl : string
15
19
theme : EditorTheme
16
20
} ) {
21
+ const inputBorder = getColor ( theme , ColorName . InputBorder )
17
22
return (
18
23
< >
19
24
< FrameButtons />
20
25
< Back />
21
26
< Forward />
22
27
{ /* <Refresh /> */ }
23
- < input value = { url || "" } readOnly />
24
- < Open href = { linkUrl } />
28
+ < input
29
+ value = { url || "" }
30
+ readOnly
31
+ style = { {
32
+ background : getColor (
33
+ theme ,
34
+ ColorName . InputBackground
35
+ ) ,
36
+ color : getColor ( theme , ColorName . InputForeground ) ,
37
+ border : inputBorder
38
+ ? `1px solid ${ inputBorder } `
39
+ : undefined ,
40
+ } }
41
+ />
42
+ < Open
43
+ href = { linkUrl }
44
+ style = { {
45
+ color : getColor (
46
+ theme ,
47
+ ColorName . EditorForeground
48
+ ) ,
49
+ } }
50
+ />
25
51
</ >
26
52
)
27
53
}
Original file line number Diff line number Diff line change 1
1
# Hello
2
2
3
- <CH.Preview show = " /" style = { { height: 200 }} />
3
+ <CH.Preview
4
+ show = " /"
5
+ style = { { height: 200 }}
6
+ url = " https://google.com"
7
+ />
Original file line number Diff line number Diff line change @@ -39,14 +39,18 @@ export enum ColorName {
39
39
TabBorder ,
40
40
ActiveTabBottomBorder ,
41
41
LineNumberForeground ,
42
+ InputForeground ,
43
+ InputBackground ,
44
+ InputBorder ,
42
45
}
43
46
44
47
type Color = string | undefined
45
48
46
49
const contrastBorder = "#6FC3DF"
47
50
48
51
// defaults from: https://github.com/microsoft/vscode/blob/main/src/vs/workbench/common/theme.ts
49
- // and: https://github.com/microsoft/vscode/blob/main/src/vs/editor/common/view/editorColorRegistry.ts
52
+ // and: https://github.com/microsoft/vscode/blob/main/src/vs/editor/common/core/editorColorRegistry.ts
53
+ // and: https://github.com/microsoft/vscode/blob/main/src/vs/platform/theme/common/colorRegistry.ts
50
54
// keys from : https://code.visualstudio.com/api/references/theme-color#editor-groups-tabs
51
55
export function getColor (
52
56
theme : EditorTheme ,
@@ -161,7 +165,29 @@ export function getColor(
161
165
hc : "#fffffe" ,
162
166
} )
163
167
)
164
-
168
+ case ColorName . InputBackground :
169
+ return (
170
+ colors [ "input.background" ] ||
171
+ getDefault ( theme , {
172
+ dark : "#3C3C3C" ,
173
+ light : "#fffffe" ,
174
+ hc : "#000000" ,
175
+ } )
176
+ )
177
+ case ColorName . InputForeground :
178
+ return (
179
+ colors [ "input.foreground" ] ||
180
+ getColor ( theme , ColorName . EditorForeground )
181
+ )
182
+ case ColorName . InputBorder :
183
+ return (
184
+ colors [ "input.border" ] ||
185
+ getDefault ( theme , {
186
+ dark : undefined ,
187
+ light : undefined ,
188
+ hc : contrastBorder ,
189
+ } )
190
+ )
165
191
default :
166
192
return "#f00"
167
193
}
You can’t perform that action at this time.
0 commit comments