@@ -820,10 +820,24 @@ class ChatMessageItem: ChatRowItem {
820
820
header = TextNode . layoutText ( . initialize( string: lg. prefixWithDots ( 15 ) , color: blockColor. main, font: . medium( . text) ) , nil , 1 , . end, NSMakeSize ( . greatestFiniteMagnitude, . greatestFiniteMagnitude) , nil , false , . left)
821
821
822
822
let tetriary : NSColor
823
+ let dark : Bool
823
824
if bubbled {
824
- tetriary = NSColor . black
825
+ let isIncoming = message? . isIncoming ( context. account, bubbled) ?? false
826
+ if isIncoming {
827
+ tetriary = blockColor. main
828
+ dark = isDark
829
+ } else {
830
+ if isDark {
831
+ tetriary = NSColor . black
832
+ dark = isDark
833
+ } else {
834
+ tetriary = blockColor. main
835
+ dark = false
836
+ }
837
+ }
825
838
} else {
826
839
tetriary = blockColor. main
840
+ dark = isDark
827
841
}
828
842
829
843
string. addAttribute ( TextInputAttributes . quote, value: TextViewBlockQuoteData ( id: Int ( arc4random64 ( ) ) , colors: . init( main: blockColor. main, secondary: nil , tertiary: tetriary) , isCode: true , space: 4 , header: header) , range: range)
@@ -832,9 +846,9 @@ class ChatMessageItem: ChatRowItem {
832
846
string. addAttribute ( TextInputAttributes . monospace, value: true as NSNumber , range: range)
833
847
834
848
835
- if let language = language {
849
+ if let language = language? . lowercased ( ) {
836
850
let code = string. attributedSubstring ( from: range) . string
837
- let syntaxed = CodeSyntax . syntax ( code: code, language: language, theme: . init( dark: bubbled ? true : isDark , textColor: textColor, textFont: . code( fontSize) , italicFont: . italicMonospace( fontSize) , mediumFont: . semiboldMonospace( fontSize) ) )
851
+ let syntaxed = CodeSyntax . syntax ( code: code, language: language, theme: . init( dark: dark , textColor: textColor, textFont: . code( fontSize) , italicFont: . italicMonospace( fontSize) , mediumFont: . semiboldMonospace( fontSize) ) )
838
852
CodeSyntax . apply ( syntaxed, to: string, offset: range. location)
839
853
}
840
854
0 commit comments