Add ui.menu text style (#664)

* add menu text style

* add ui.menu.text ui.info ui.info.text to book

* change ui.menu.text to ui.menu

* fix book's ui.menu
This commit is contained in:
CossonLeo 2021-08-28 12:54:24 +08:00 committed by GitHub
parent f22e0aa2ae
commit d6a9c2c0f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -91,6 +91,9 @@ ## Creating a theme
| `ui.help` | | | `ui.help` | |
| `ui.text` | | | `ui.text` | |
| `ui.text.focus` | | | `ui.text.focus` | |
| `ui.info` | |
| `ui.info.text` | |
| `ui.menu` | |
| `ui.menu.selected` | | | `ui.menu.selected` | |
| `ui.selection` | For selections in the editing area | | `ui.selection` | For selections in the editing area |
| `ui.selection.primary` | | | `ui.selection.primary` | |

View File

@ -259,8 +259,11 @@ fn required_size(&mut self, viewport: (u16, u16)) -> Option<(u16, u16)> {
// TODO: required size should re-trigger when we filter items so we can draw a smaller menu // TODO: required size should re-trigger when we filter items so we can draw a smaller menu
fn render(&mut self, area: Rect, surface: &mut Surface, cx: &mut Context) { fn render(&mut self, area: Rect, surface: &mut Surface, cx: &mut Context) {
let style = cx.editor.theme.get("ui.text"); let theme = &cx.editor.theme;
let selected = cx.editor.theme.get("ui.menu.selected"); let style = theme
.try_get("ui.menu")
.unwrap_or_else(|| theme.get("ui.text"));
let selected = theme.get("ui.menu.selected");
let scroll = self.scroll; let scroll = self.scroll;