Skip to content
Snippets Groups Projects
Verified Commit ff4f93b9 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Fix bug with background-only hex colors

parent 981ff07f
No related branches found
No related tags found
No related merge requests found
Pipeline #246 passed
...@@ -66,6 +66,10 @@ class IrcFormatSerializer @Inject constructor(context: Context) { ...@@ -66,6 +66,10 @@ class IrcFormatSerializer @Inject constructor(context: Context) {
getColor(0, 0) getColor(0, 0)
} }
private val colorForegroundHex = context.theme.styledAttributes(R.attr.colorForeground) {
getColor(0, 0)
}
fun toEscapeCodes(text: Spanned): String { fun toEscapeCodes(text: Spanned): String {
val out = StringBuilder() val out = StringBuilder()
withinParagraph(out, text, 0, text.length) withinParagraph(out, text, 0, text.length)
...@@ -120,6 +124,10 @@ class IrcFormatSerializer @Inject constructor(context: Context) { ...@@ -120,6 +124,10 @@ class IrcFormatSerializer @Inject constructor(context: Context) {
out.append(',') out.append(',')
out.append(String.format(Locale.US, "%06x", background and 0x00FFFFFF)) out.append(String.format(Locale.US, "%06x", background and 0x00FFFFFF))
} }
} else if (background != null) {
out.append(String.format(Locale.US, "%06x", this.colorForegroundHex and 0x00FFFFFF))
out.append(',')
out.append(String.format(Locale.US, "%06x", background and 0x00FFFFFF))
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment