-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is new feature: custom style. This feature is originally proposed at ueokande/vim-vixen#161. This change supports custom styles for hint and console.
- Loading branch information
Showing
49 changed files
with
753 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
title: Custom Styles | ||
--- | ||
|
||
# Custom Styles | ||
|
||
Users can specify custom styles in CSS format for certain components. | ||
|
||
```json | ||
{ | ||
"styles": { | ||
"hint": { | ||
"background-color": "yellow", | ||
"border": "1px solid gold", | ||
"font-weight": "bold", | ||
"font-size": "12px", | ||
"color": "black" | ||
}, | ||
"console": { | ||
"font-family": "monospace", | ||
"font-size": "12px" | ||
} | ||
} | ||
} | ||
|
||
``` | ||
|
||
Vimmatic supports the two types of components: | ||
|
||
- `hint`: Hint tags in follow mode. | ||
- `console`: Console at the bottom of the page. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { injectable, inject } from "inversify"; | ||
import SettingsRepository from "./SettingsRepository"; | ||
import { ComponentName } from "../../shared/Styles"; | ||
import { defaultSettings } from "../../settings"; | ||
|
||
export default interface StyleSettings { | ||
getStyle(name: string): Promise<Record<string, string>>; | ||
} | ||
|
||
@injectable() | ||
export class StyleSettingsImpl { | ||
constructor( | ||
@inject("SettingsRepository") | ||
private readonly settingsRepository: SettingsRepository | ||
) {} | ||
|
||
async getStyle(name: ComponentName): Promise<Record<string, string>> { | ||
const settings = await this.settingsRepository.load(); | ||
const value = (settings.styles || {})[name]; | ||
if (typeof value === "undefined") { | ||
return defaultSettings.styles![name]!; | ||
} | ||
return value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.