[Question]Customise Header color
See original GitHub issue- Markwon version: {3.0.0}
I am looking to implement a different colour for the headers. Also, I’ve seen someone asked this in past with this https://github.com/noties/Markwon/issues/32. Looks like SpannableMarkdownVisitor contract has been changed.
I’ve tried the below code and the issue with the code is the header is not being visible after my change and even it doesn’t show the default color.
Markwon.builder(context)
.usePlugin(object : AbstractMarkwonPlugin() {
override fun configureVisitor(builder: MarkwonVisitor.Builder) {
builder.on(Heading::class.java) { visitor, heading ->
val start = visitor.length()
visitor.setSpans(start, ForegroundColorSpan(Color.BLACK))
super.configureVisitor(builder)
}
}
})
.build()
Could you please let me know how this can be achieved now.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Change survey question header colors - ServiceNow Docs
Enter the hexadecimal value of the desired color into the Value field. Click Submit. The survey should now use the desired color.
Read more >How can change header background-color?
Maria Spassova (Customer) asked a question. ... How can change header background-color? Hi,. is it possible to change header background-color /#Header/ when I ......
Read more >Custom Style: Can't Change Header Color - JoomShaper
Ariba. Kindly check the screenshot - I have changed the header color to white from custom style option. After changing the color and...
Read more >How to change survey header color only - surveyjs Support
Hi,. i am trying to change the color of header only , i am using customization as given in survey library. ... .applyTheme();....
Read more >How can I change the background color of specific header ...
... the form will need access to the "edit submission" link, ... one of the headers, along with the background color of two...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello @nksaroj !
You place it in a custom plugin, of cause 😄 !
BTW, I’m going to add
addFactory
method for easier factories management, it will published with next SNAPSHOT.Now, bullet size. Well, you cannot easily change it’s width. First of all - because a bullet item cannot modify metrics. (So no line height change, no left margin will grow to fit a bigger bullet item). Currently it’s width calculated like this:
So, it cannot be greater than half of
blockMargin
orlineHeight
(whatever is smaller). Please note, that it can be less.blockMargin
is a property ofMarkwonTheme
. It controls the right margin for text content for bullet-list, ordered-list, block-quote and task-list. If you increase it and also increase line height -> then you can also make bullet greater.bulletListItemStrokeWidth
is working. Although its name is not clear, I agree that it can be confusing. All it does is — control the stroke width of a bullet point of the second level list, see the second line:Hello @nksaroj !
Version
3.0.0
allows customizing spans via factory. So you no longer need to customize visitor. What you are asking can be achieved like this:The snippet that you had shared could’ve also work, but it needs a few changes:
So, it’s up to you to pick the solution that works for you. But I had added
SpanFactory
exactly for easier customization of spans that are used (so you don’t have to use visitor until you absolutely need to)