Skip to content

Commit

Permalink
feat(androidstudio): add androidstudioInit method to androidstudio th…
Browse files Browse the repository at this point in the history
…eme.
  • Loading branch information
jaywcjlove committed Dec 7, 2022
1 parent 82d86e5 commit 61f38d1
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 23 deletions.
26 changes: 26 additions & 0 deletions themes/androidstudio/README.md
Expand Up @@ -16,6 +16,32 @@
npm install @uiw/codemirror-theme-androidstudio --save
```

```jsx
import { tags as t } from '@lezer/highlight';
import { androidstudio, androidstudioInit } from '@uiw/codemirror-theme-androidstudio';

<CodeMirror theme={androidstudio} />
<CodeMirror
theme={androidstudioInit({
settings: {
caret: '#c6c6c6',
fontFamily: 'monospace',
},
styles: [
{ tag: t.comment, color: '#6272a4' },
]
})}
/>
```

## API

```tsx
import { CreateThemeOptions } from '@uiw/codemirror-themes';
export declare const androidstudioInit: (options?: CreateThemeOptions) => import('@codemirror/state').Extension;
export declare const androidstudio: import('@codemirror/state').Extension;
```

## Usage

```jsx
Expand Down
53 changes: 30 additions & 23 deletions themes/androidstudio/src/index.ts
Expand Up @@ -2,27 +2,34 @@
* @name androidstudio
*/
import { tags as t } from '@lezer/highlight';
import { createTheme } from '@uiw/codemirror-themes';
import { createTheme, CreateThemeOptions } from '@uiw/codemirror-themes';

export const androidstudio = createTheme({
theme: 'dark',
settings: {
background: '#282b2e',
foreground: '#a9b7c6',
caret: '#00FF00',
selection: '#343739',
selectionMatch: '#343739',
lineHighlight: '#343739',
},
styles: [
{ tag: [t.keyword, t.deleted, t.className], color: '#cc7832' },
{ tag: [t.number, t.literal, t.derefOperator], color: '#6897bb' },
{ tag: [t.link, t.variableName], color: '#629755' },
{ tag: [t.comment, t.quote], color: 'grey' },
{ tag: [t.meta, t.documentMeta], color: '#bbb529' },
{ tag: [t.string, t.propertyName, t.attributeValue], color: '#6a8759' },
{ tag: [t.heading, t.typeName], color: '#ffc66d' },
{ tag: [t.attributeName], color: '#a9b7c6' },
{ tag: [t.emphasis], fontStyle: 'italic' },
],
});
export const androidstudioInit = (options?: CreateThemeOptions) => {
const { theme = 'light', settings = {}, styles = [] } = options || {};
return createTheme({
theme: theme,
settings: {
background: '#282b2e',
foreground: '#a9b7c6',
caret: '#00FF00',
selection: '#343739',
selectionMatch: '#343739',
lineHighlight: '#343739',
...settings,
},
styles: [
{ tag: [t.keyword, t.deleted, t.className], color: '#cc7832' },
{ tag: [t.number, t.literal, t.derefOperator], color: '#6897bb' },
{ tag: [t.link, t.variableName], color: '#629755' },
{ tag: [t.comment, t.quote], color: 'grey' },
{ tag: [t.meta, t.documentMeta], color: '#bbb529' },
{ tag: [t.string, t.propertyName, t.attributeValue], color: '#6a8759' },
{ tag: [t.heading, t.typeName], color: '#ffc66d' },
{ tag: [t.attributeName], color: '#a9b7c6' },
{ tag: [t.emphasis], fontStyle: 'italic' },
...styles,
],
});
};

export const androidstudio = androidstudioInit();

0 comments on commit 61f38d1

Please sign in to comment.