Skip to content

Commit

Permalink
MarkSpan - Set color from HTML attributes if they exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerardo committed Feb 27, 2024
1 parent 9b97880 commit bdfb20f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions aztec/src/main/kotlin/org/wordpress/aztec/spans/MarkSpan.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.graphics.Color
import android.text.TextPaint
import android.text.style.CharacterStyle
import org.wordpress.aztec.AztecAttributes
import org.wordpress.aztec.source.CssStyleFormatter

class MarkSpan : CharacterStyle, IAztecInlineSpan {
override var TAG = "mark"
Expand All @@ -13,6 +14,12 @@ class MarkSpan : CharacterStyle, IAztecInlineSpan {

constructor(attributes: AztecAttributes = AztecAttributes()) : super() {
this.attributes = attributes

val color = CssStyleFormatter.getStyleAttribute(attributes,
CssStyleFormatter.CSS_COLOR_ATTRIBUTE)
if (color.isNotEmpty()) {
textColor = Color.parseColor(color)
}
}

constructor(attributes: AztecAttributes = AztecAttributes(), colorString: String?) : super() {
Expand Down

0 comments on commit bdfb20f

Please sign in to comment.