Skip to content

Commit

Permalink
Ensure separator styles apply correctly from theme
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Jul 29, 2024
1 parent 6ae7586 commit 664b2dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/posting/highlighters.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ def highlight_url(text: Text, styles: UrlStyles) -> None:
separator_start, separator_end = protocol_end, protocol_end + 3

text.stylize(styles.protocol or "#818cf8", protocol_start, protocol_end)
text.stylize("dim", separator_start, separator_end)
text.stylize(styles.separator or "dim b", separator_start, separator_end)
text.stylize(styles.base or "#00C168", base_start, base_end)

for index, char in enumerate(text.plain):
if char == "/":
text.stylize("dim b", index, index + 1)
text.stylize(styles.separator or "dim b", index, index + 1)


def highlight_variables(text: Text, styles: VariableStyles) -> None:
Expand Down
4 changes: 2 additions & 2 deletions src/posting/themes.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ class UrlStyles(BaseModel):
base: str | None = Field(default=None)
"""The style to apply to the base of the URL."""

protocol: str = Field(default=None)
protocol: str | None = Field(default=None)
"""The style to apply to the URL protocol."""

separator: str = Field(default="dim b")
separator: str | None = Field(default="dim b")
"""The style to apply to URL separators e.g. `/`."""


Expand Down

0 comments on commit 664b2dd

Please sign in to comment.