How can I style just the number prefix?
-
Hello
I’m trying to style the number prefix in this language definition. It doesn’t seem to work, and I can’t seem to find other styles that has this.
What I want is the prefix for numbers to be in a different style than the number. Like:
#05
I want the # to be in one style, and the 05 to be in another.
Any way to do this?
Thanks in advance!
Peter
-
@Peter-Lind said in How can I style just the number prefix?:
Any way to do this?
In just native UDL? No.
With the EnhanceAnyLexer plugin, you could define a regex that would be used to change the foreground color of matched text. For example, if you want
#$ #% # $ %as prefixes to numbers to be a different color than the rest of the number, you could use Plugins > EnhanceAnyLexer > Enhance current language, then use0x0000FF = (?-s)(#\$|#%|#|\$|%)(?=[0-9a-f])You also either need to make sure that
3isn’t in the list ofexcluded_stylesin that config, or use the newer syntax (described in the ini file) which allows specifying a regex only for the specific style #3.This will turn the
#$ #% # $ %prefixes red, even though the rest of the number is pink; and if those sequences aren’t before a valid number, then it won’t be highlighted either:

-
@ PeterJones Thank you!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login