Sublime Forum

ColorHelper 2.0.0

#41

Have you tried using minihtml directly to generate the color via a background-color applied to a transparent image? If that worked, it would mean you wouldn’t need to generate images on the fly with the various colors.

As of 3119 there is support for colors in hex, hex with alpha, short hex, short hex with alpha, rgb, rgba, hsl and hsla in minihtml. As long as you detect one of those color formats, you should theoretically be able to pass it directly in.

1 Like

#42

This was created before minihtml added such features. Also, I kind of still need to generate to generate images as I need scale images with font_size. My images have checkered board patterns for transparency etc. What looks good and one resolution does not look good at another. So it is a bit more complicated than that.

0 Likes

#43

Please remove this “forcing”, the extra padding is a bug and the theme should control the padding and other css rules. Material Theme will fix this in the next release, after your fix.

1 Like

#44

I understand what you are suggesting. ColorHelper uses a dependency called mdpopups. Keep in mind that I wrote mdpopups before Sublime started generating colors for schemes etc. With that said, mdpopups generates a basic default CSS with more practical styles for existing elements and for elements not yet styled. I just can’t see a practical need for the current giant H1 element with padding in a popup or inline phantom etc.; what I needed in an HTML web page is different than what I need in a popup or phantom.

It approaches it by:

  • creating a reasonable basic/minimal styling as a base.
  • It generates color classes that match a scheme and does minimal colorization (in fact I am scaling back on what I was colorizing before in the next release to be more minimal). But again, this was done before Sublime started generating colors itself.
  • Plugin users are encouraged to use classes on anything they colorize by namespacing their classes because minihtml CSS doesn’t work on this class1 class2, only stuff like this works class1.class2 (maybe this has changed?).
  • Lastly, users can override anything with a user CSS. If they don’t like what a plugin author chose, they can use a custom user default CSS to override their namespaced class element. They don’t like what I chose as the default style, custom user CSS to override the defaults. The user gets to make the final call. I don’t trust the choices of style of every plugin creator/theme creator. Nor do I expect everyone should trust me as well. Nor do I want to argue style choices with with any with every plugin creator. I can override anything in my user folder.
  • Users also get template variables to check different sublime versions in their CSS and other various stuff, and a couple of filters to adjust colors, import other external CSS for different reasons etc. (this was again created before Sublime had or documented their color blending methods etc.)

Anyways, I try to give a basic, reasonable, and common CSS in all my plugins via mdpopups, and then I let the users override any of my choices if they like. I am glad Sublime is being a little better with their defaults, but I still need something a bit more flexible.

1 Like

#45

I have no intentions of removing it at this time as it protects against anyone who might do something similar. Any user that is using a plugin that uses my mdpopups dependency as the ability to override my choices in their own user CSS, so it is not a permanent forcing. I plan on keeping this way for the immediate future.

0 Likes

#46

@wbond On thing I suggest Sublime works on is better CSS rules. If this hasn’t been added currently, things like this should work and will make style much easier: class1 class2{}. Second, I’ve seen issues where I can apply a background color to a block element, and then when I try to apply a background color via the style attribute in an inline child element, the background of the inline element doesn’t apply.

Oh, and borders would be such a help. If I could get borders, when I syntax highlight code I wouldn’t have to apply a different background to a block element and additionally apply backgrounds to spans. to differentiate the regions.

1 Like

#47

Your plugin should not force the css and the appearance of a view. At the moment all the rules inside the html selector are ignored by this plugin. Not only the padding.

0 Likes

#48

You can override the defaults with whatever your theme uses, or you can not use any of my plugins that utilize this. At the very minimum, I can add an option to side step the mdpopups defaults entirely via a template variable, this is a reasonable compromise. A user can still override anything they want, and that is what I like. The user gets the final say, and that will not change.

0 Likes

#49

Please provide a full list of the css selectors used, html tags with the default values, otherwise no one can override the css of this plugin.

0 Likes

#50

Child selectors were added in 3119, and inline element background colors should works fine above block-level background colors. These are both used by the default style for inline error messages.

Borders are on my list of things to implement.

2 Likes

#51

Thank you! I will take a look at this and begin altering how I approach things :slightly_smiling:.

Fantastic!

0 Likes

#52

There is also inline element padding and relative positioning. Plus one of my favorites: border-radius. :grinning: You should definitely check out the docs for minihtml.

While there isn’t background image support yet (for checkerboard), using a rem width/height on a transparent image should help get it sized properly. We should eventually get to the point where generating images will not be required.

2 Likes

#53

I am very excited. I do plan on looking into this more. This will be so much faster the day I can use mainly CSS.

1 Like

#54

This is all available already. The document links to the actual CSS files so you can see all the selectors. With that said, today I have stripped things down considerably. Basic formatting and very minimal colors. If you are using ST 3119+, it won’t even define any colors as it is assumed Sublime will auto-gen them or the theme is providing them. I think it still provides pre and code background colors if you use mdpopups syntax highlighting.

By creating a mdpopups.css in your user folder, mdpopups will use that CSS instead of its default CSS it uses for superficial styling. The base formatting will still be applied but can be overridden directly in mdpopups.css. This already exists in current versions and is documented.

You can also turn off the base formatting entirely by adding mdpopups.default_formatting to your Preferences.sublime-settings file and setting it to False. Be aware that any special formatting that Sublime isn’t already doing is wiped away by doing this. This will be in the new version coming soon.

Anyways, I will probably release the new version tomorrow.

0 Likes

#55

Is this CH or Material? (Both the position and the width are a little weird)

I’m using windows 10, ST 3120, CH 2.0.4, Material 3.0.4

The screenshot the author of Material theme posted looks very nice:

0 Likes

#56

I think it is something specific with your setup. I would need you to post support info. I would also need you to confirm you are using his color scheme and whether you are on his latest. Also, I would need you to confirm you are or are not overriding any of mdpopups CSS in mdpopups.css.

What I find weird is your images look squished, and I render them square, so idk. I just installed his Theme and mine looked fine when I tried it.

0 Likes

#57

Very interesting… I just downloaded a portable version of Sublime and installed the two packages. And the phantom looks exactly like what I had in my own screenshot. I’m on Windows 10 with a UHD screen, could that be the reason? @jps

0 Likes

#58

Maybe try playing with the inline_preview_offset setting.

0 Likes

#59

with inline_preview_offset: -15

with inline_prever_offset: 15

extreme cases, but… there always is the gap thingy below the color tile, weird.

0 Likes

#60

Make sure you have the latest mdpopups and ColorHelper. Check that you don’t have a mdpopups.css in your user folder overriding stuff. double check the CSS in your color scheme. I don’t generate the images with padding. I don’t style them with any padding in the most recent versions of things.

Maybe Sublime is doing with things if everything else checks out. I do see occasional image glitches.

0 Likes