Skip to content

Commit

Permalink
Ensure that theme values are non-nil
Browse files Browse the repository at this point in the history
  • Loading branch information
rads-reify authored and rads committed Apr 12, 2024
1 parent 2b38b37 commit 6d04989
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,19 @@
([key]
(get-color (.getGlobalScheme (EditorColorsManager/getInstance)) key))
([^EditorColorsScheme theme key]
(some->
(if-let [attrs (language-colors key)]
(cond
(instance? ColorKey attrs)
(.getColor theme ^ColorKey attrs)
(instance? TextAttributesKey attrs)
(some-> theme (.getAttributes ^TextAttributesKey attrs) .getForegroundColor))
(.getColor theme (ColorKey/createColorKey (name key))))
format-color)))
(let [defaults (.getScheme (EditorColorsManager/getInstance) EditorColorsManager/DEFAULT_SCHEME_NAME)]
(some->
(if-let [attrs (language-colors key)]
(cond
(instance? ColorKey attrs)
(.getColor theme ^ColorKey attrs)

(instance? TextAttributesKey attrs)
(or
(some-> theme (.getAttributes ^TextAttributesKey attrs) .getForegroundColor)
(some-> defaults (.getAttributes ^TextAttributesKey attrs) .getForegroundColor)))
(.getColor theme (ColorKey/createColorKey (name key))))
format-color))))

(defn- get-font
([]
Expand Down

0 comments on commit 6d04989

Please sign in to comment.