Sublime Forum

Minihtml best practises to work alongside theme developers

#1

Hi all,

On this page, I don’t really understand the “Best Practises” section. I have a bunch of Phantoms for my View, and some Phantoms are warnings, some are errors, some are remarks. If I style the Phantom with, for example

point = get_from_somewhere()
region = sublime.Region(point, point)
message = '<body><div class="error">hello, world!</div></body>'
phantom = sublime.Phantom(region, message, sublime.LAYOUT_BELOW)

The Phantom turns up red, which is great. By experimentation, when the message is

message = '<body><div class="warning">hello, world!</div></body>'

the Phantom turns up yellow, which is also great. Now, why should I give the body a unique id as in the “Best Practises” section? Next, why should I put a custom style block in the minihtml as in the “Best Practises” section? Finally, where are all the default div classes that I can use?

1 Like

#2

It literally says this:

To allow color scheme authors to tweak the look of popups and phantoms, it is best to add a unique id="" attribute to the tag of your plugin’s HTML.

By adding a unique id, a CSS selector can be added to the color scheme’s phantomCss (or popupCss) key that will override attributes only for this particular popup/phantom.

I could only find this post:

I believe that the colors are now inferred from the generated variables like var(--redish) instead of #FF0000.

4 Likes

#3

It has nothing to do with this, but you can just do: sublime.Region(point)

>>> sublime.Region(5) == sublime.Region(5, 5)
True
0 Likes