From 91d9af7c743bde45b00fde48455953edb56a2d4d Mon Sep 17 00:00:00 2001 From: Darren Burns Date: Tue, 3 Dec 2024 11:23:37 +0000 Subject: [PATCH] Theme updates --- poetry.lock | 22 +++++++++--------- src/textual/_text_area_theme.py | 23 +++++++++++++------ .../document/_syntax_aware_document.py | 2 +- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/poetry.lock b/poetry.lock index a7dffd63f5..0edad59b09 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2556,23 +2556,23 @@ core = ["tree-sitter (>=0.22,<1.0)"] [[package]] name = "tree-sitter-toml" -version = "0.6.0" +version = "0.7.0" description = "TOML grammar for tree-sitter" optional = true -python-versions = ">=3.8" +python-versions = ">=3.9" files = [ - {file = "tree-sitter-toml-0.6.0.tar.gz", hash = "sha256:b7fad4382760269a24d0368329cfb10764359acc1bb648598f0ef347b8cc3a61"}, - {file = "tree_sitter_toml-0.6.0-cp38-abi3-macosx_10_9_x86_64.whl", hash = "sha256:0591b6672ab6289ac63f40b017e04cb514f5957d6b0b0c4dcfa06796b14db849"}, - {file = "tree_sitter_toml-0.6.0-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:f63b84e255a1fb7e183dff492f461fa4e0c3e00edf29b7f7d710aba24195a30c"}, - {file = "tree_sitter_toml-0.6.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4279a0296e04824e663640da9e6fd4d34273d943e77a731141f401ebf94d304d"}, - {file = "tree_sitter_toml-0.6.0-cp38-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:272737a159752937f693b016409ddb2f3291f9f37a86484d6342850727d8440c"}, - {file = "tree_sitter_toml-0.6.0-cp38-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:02b8bcd65ca23b66357b1ec2a9eac941224ad7c1212c2cea3005beefba46a152"}, - {file = "tree_sitter_toml-0.6.0-cp38-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:d383674a1225ed244bbfcd58c7d9ca5e140beddc1f0993cf2844a73edb5f4cfd"}, - {file = "tree_sitter_toml-0.6.0-cp38-abi3-win_amd64.whl", hash = "sha256:dad47b03c69f9d0894ecfca8682ac4cd22cc43c32670a8a3e784b27e4de6f7c2"}, + {file = "tree_sitter_toml-0.7.0-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:b9ae5c3e7c5b6bb05299dd73452ceafa7fa0687d5af3012332afa7757653b676"}, + {file = "tree_sitter_toml-0.7.0-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:18be09538e9775cddc0290392c4e2739de2201260af361473ca60b5c21f7bd22"}, + {file = "tree_sitter_toml-0.7.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a045e0acfcf91b7065066f7e51ea038ed7385c1e35e7e8fae18f252d3f8adb8c"}, + {file = "tree_sitter_toml-0.7.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7a2f8cf9d73f07b6628093b35e5c5fbac039247e32cb075eaa5289a5914e73af"}, + {file = "tree_sitter_toml-0.7.0-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:860ffa4513b2dc3083d8e412bd815a350b0a9490624b37e7c8f6ed5c6f9ce63c"}, + {file = "tree_sitter_toml-0.7.0-cp39-abi3-win_amd64.whl", hash = "sha256:2760a04f06937b01b1562a2135cd7e8207e399e73ef75bbebc77e37b1ad3b15d"}, + {file = "tree_sitter_toml-0.7.0-cp39-abi3-win_arm64.whl", hash = "sha256:fd00fd8a51c65aa19c40539431cb1773d87c30af5757b4041fa6c229058420b4"}, + {file = "tree_sitter_toml-0.7.0.tar.gz", hash = "sha256:29e257612fa8f0c1fcbc4e7e08ddc561169f1725265302e64d81086354144a70"}, ] [package.extras] -core = ["tree-sitter (>=0.21,<1.0)"] +core = ["tree-sitter (>=0.22,<1.0)"] [[package]] name = "tree-sitter-xml" diff --git a/src/textual/_text_area_theme.py b/src/textual/_text_area_theme.py index 3db676d04b..3fcd74c4aa 100644 --- a/src/textual/_text_area_theme.py +++ b/src/textual/_text_area_theme.py @@ -148,7 +148,7 @@ def apply_css(self, text_area: TextArea) -> None: self.selection_style = selection_style else: selection_background_color = background_color.blend( - app_theme.primary, factor=0.75 + app_theme.primary, factor=0.5 ) self.selection_style = Style.from_color( bgcolor=selection_background_color.rich_color @@ -204,7 +204,7 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "string": Style(color="#E6DB74"), "string.documentation": Style(color="#E6DB74"), "comment": Style(color="#75715E"), - "heading.marker": Style(color="#75715E"), + "heading.marker": Style(color="#90908a"), "keyword": Style(color="#F92672"), "operator": Style(color="#F92672"), "repeat": Style(color="#F92672"), @@ -218,6 +218,7 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "float": Style(color="#AE81FF"), "class": Style(color="#A6E22E"), "type.class": Style(color="#A6E22E"), + "type.builtin": Style(color="#66D9EF"), "function": Style(color="#A6E22E"), "function.call": Style(color="#A6E22E"), "method": Style(color="#A6E22E"), @@ -239,8 +240,9 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "strikethrough": Style(strike=True), "link.label": Style(color="#F92672"), "link.uri": Style(color="#66D9EF", underline=True), - "list.marker": Style(color="#75715E"), + "list.marker": Style(color="#90908a"), "inline_code": Style(color="#E6DB74"), + "punctuation.delimiter": Style(color="#90908a"), }, ) @@ -271,6 +273,7 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "float": Style(color="#bd93f9"), "class": Style(color="#50fa7b"), "type.class": Style(color="#50fa7b"), + "type.builtin": Style(color="#bd93f9"), "function": Style(color="#50fa7b"), "function.call": Style(color="#50fa7b"), "method": Style(color="#50fa7b"), @@ -294,6 +297,7 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "link.uri": Style(color="#bd93f9", underline=True), "list.marker": Style(color="#6272a4"), "inline_code": Style(color="#f1fa8c"), + "punctuation.delimiter": Style(color="#ff79c6"), }, ) @@ -310,7 +314,7 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "string": Style(color="#ce9178"), "string.documentation": Style(color="#ce9178"), "comment": Style(color="#6A9955"), - "heading.marker": Style(color="#6A9955"), + "heading.marker": Style(color="#6E7681"), "keyword": Style(color="#569cd6"), "operator": Style(color="#569cd6"), "conditional": Style(color="#569cd6"), @@ -324,6 +328,7 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "float": Style(color="#b5cea8"), "class": Style(color="#4EC9B0"), "type.class": Style(color="#4EC9B0"), + "type.builtin": Style(color="#7DAF9C"), "function": Style(color="#4EC9B0"), "function.call": Style(color="#4EC9B0"), "method": Style(color="#4EC9B0"), @@ -341,9 +346,10 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "strikethrough": Style(strike=True), "link.uri": Style(color="#40A6FF", underline=True), "link.label": Style(color="#569cd6"), - "list.marker": Style(color="#6A9955"), + "list.marker": Style(color="#6E7681"), "inline_code": Style(color="#ce9178"), "info_string": Style(color="#ce9178", bold=True, italic=True), + "punctuation.delimiter": Style(color="#6E7681"), }, ) @@ -360,7 +366,9 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "string": Style(color="#093069"), "string.documentation": Style(color="#093069"), "comment": Style(color="#6a737d"), - "heading.marker": Style(color="#6a737d"), + "heading.marker": Style(color="#A4A4A4"), + "type.class": Style(color="#A4A4A4"), + "type.builtin": Style(color="#7DAF9C"), "keyword": Style(color="#d73a49"), "operator": Style(color="#0450AE"), "conditional": Style(color="#CF222E"), @@ -389,8 +397,9 @@ def builtin_themes(cls) -> list[TextAreaTheme]: "strikethrough": Style(strike=True), "link.uri": Style(color="#40A6FF", underline=True), "link.label": Style(color="#6639BB"), - "list.marker": Style(color="#6a737d"), + "list.marker": Style(color="#A4A4A4"), "inline_code": Style(color="#093069"), + "punctuation.delimiter": Style(color="#A4A4A4"), }, ) diff --git a/src/textual/document/_syntax_aware_document.py b/src/textual/document/_syntax_aware_document.py index 55db3e973c..203328e0e5 100644 --- a/src/textual/document/_syntax_aware_document.py +++ b/src/textual/document/_syntax_aware_document.py @@ -52,7 +52,7 @@ def __init__( self._parser: Parser | None = None - from textual._tree_sitter import Parser, get_language + from textual._tree_sitter import get_language # If the language is `None`, then avoid doing any parsing related stuff. if isinstance(language, str):