Skip to content

Commit 61f38d1

Browse files
committed
feat(androidstudio): add androidstudioInit method to androidstudio theme.
1 parent 82d86e5 commit 61f38d1

File tree

2 files changed

+56
-23
lines changed

2 files changed

+56
-23
lines changed

themes/androidstudio/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,32 @@
1616
npm install @uiw/codemirror-theme-androidstudio --save
1717
```
1818

19+
```jsx
20+
import { tags as t } from '@lezer/highlight';
21+
import { androidstudio, androidstudioInit } from '@uiw/codemirror-theme-androidstudio';
22+
23+
<CodeMirror theme={androidstudio} />
24+
<CodeMirror
25+
theme={androidstudioInit({
26+
settings: {
27+
caret: '#c6c6c6',
28+
fontFamily: 'monospace',
29+
},
30+
styles: [
31+
{ tag: t.comment, color: '#6272a4' },
32+
]
33+
})}
34+
/>
35+
```
36+
37+
## API
38+
39+
```tsx
40+
import { CreateThemeOptions } from '@uiw/codemirror-themes';
41+
export declare const androidstudioInit: (options?: CreateThemeOptions) => import('@codemirror/state').Extension;
42+
export declare const androidstudio: import('@codemirror/state').Extension;
43+
```
44+
1945
## Usage
2046

2147
```jsx

themes/androidstudio/src/index.ts

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,34 @@
22
* @name androidstudio
33
*/
44
import { tags as t } from '@lezer/highlight';
5-
import { createTheme } from '@uiw/codemirror-themes';
5+
import { createTheme, CreateThemeOptions } from '@uiw/codemirror-themes';
66

7-
export const androidstudio = createTheme({
8-
theme: 'dark',
9-
settings: {
10-
background: '#282b2e',
11-
foreground: '#a9b7c6',
12-
caret: '#00FF00',
13-
selection: '#343739',
14-
selectionMatch: '#343739',
15-
lineHighlight: '#343739',
16-
},
17-
styles: [
18-
{ tag: [t.keyword, t.deleted, t.className], color: '#cc7832' },
19-
{ tag: [t.number, t.literal, t.derefOperator], color: '#6897bb' },
20-
{ tag: [t.link, t.variableName], color: '#629755' },
21-
{ tag: [t.comment, t.quote], color: 'grey' },
22-
{ tag: [t.meta, t.documentMeta], color: '#bbb529' },
23-
{ tag: [t.string, t.propertyName, t.attributeValue], color: '#6a8759' },
24-
{ tag: [t.heading, t.typeName], color: '#ffc66d' },
25-
{ tag: [t.attributeName], color: '#a9b7c6' },
26-
{ tag: [t.emphasis], fontStyle: 'italic' },
27-
],
28-
});
7+
export const androidstudioInit = (options?: CreateThemeOptions) => {
8+
const { theme = 'light', settings = {}, styles = [] } = options || {};
9+
return createTheme({
10+
theme: theme,
11+
settings: {
12+
background: '#282b2e',
13+
foreground: '#a9b7c6',
14+
caret: '#00FF00',
15+
selection: '#343739',
16+
selectionMatch: '#343739',
17+
lineHighlight: '#343739',
18+
...settings,
19+
},
20+
styles: [
21+
{ tag: [t.keyword, t.deleted, t.className], color: '#cc7832' },
22+
{ tag: [t.number, t.literal, t.derefOperator], color: '#6897bb' },
23+
{ tag: [t.link, t.variableName], color: '#629755' },
24+
{ tag: [t.comment, t.quote], color: 'grey' },
25+
{ tag: [t.meta, t.documentMeta], color: '#bbb529' },
26+
{ tag: [t.string, t.propertyName, t.attributeValue], color: '#6a8759' },
27+
{ tag: [t.heading, t.typeName], color: '#ffc66d' },
28+
{ tag: [t.attributeName], color: '#a9b7c6' },
29+
{ tag: [t.emphasis], fontStyle: 'italic' },
30+
...styles,
31+
],
32+
});
33+
};
34+
35+
export const androidstudio = androidstudioInit();

0 commit comments

Comments
 (0)