Sublime Forum

ColorHelper 2.0.0

#112

Unfortunately, I missed reporting before ST’s next beta, but I am very much convinced that ST has introduced new image sizing issues (not like the one that was just fixed, but like previous issues before that). Looks to be stretching images in the X and/or Y directions. Hopefully I will get around to posting a stripped down example tonight.

Still haven’t had a chance to test out scaling on Windows 10, but hopefully tonight as well, been a busy week for me.

0 Likes

#113

I do have an answer now for why we are getting larger than normal images in ColorHelper.

  1. The reason the scale factor in mdpopups isn’t working is because 1) images where never affected by the font scale. Images are sized based on line height. The reason why fonts are aren’t affected by recently by scale height is because mdpopups had implemented its own relative fonts, but in recent builds, Sublime provided its own relative font units. So in the latest builds, mdpoups uses Sublime’s relative font implementation by default instead of our cobbled together hack. You would have to change the default CSS to take advantage of the old font scale hack, but this is not recommended as the Sublime implementation is better and is the recommended way. So in short, I incorrectly recommended changing the font scale for recent builds. I simply forgot about these changes.

  2. Images are large because Sublime is now reporting line heights as 2X bigger in Windows 10 (have not tried Linux) than other OS’s (this is only in the very latest Sublime builds that added hi def support for Windows and Linux).

So I need to now detect Windows 10 systems with hi def screens. Python isn’t quite reporting a helpful windows version, but I am sure I should be able to figure out detection of Windows 10 systems from Windows 8 systems soon.

What is more difficult is telling when Sublime is being used on a 4k system. @wbond, @jps can we please get an API check that mentions when Sublime is in hidpi mode?

In the short term, I will work on detecting Windows 10 systems and provide a setting that can be toggled in either mdpoups or the plugin of interest (I’ll have to see where it makes sense – mabye I’ll provide a function in mdpopups that gives a useful line height) so we can calculate image height properly.

0 Likes

#114

@wbond image distortion so far seems specific to Windows 7 (on my 4K screen - havent tested on non-4K) for me. It sees to be fine on Windows 10.

0 Likes

#115

Are you referring to View.line_height()? If so, I will get that fixed. It should always return device-independent pixels (DIP), such as how CSS in minihtml deals with DIP instead of device pixels.

Without knowing more info about why, my general answer would be that this sounds like a bad idea. Sublime Text should deal with all of the scaling and resolution issues itself, and exposing this sort of thing I think it likely to result in hacks that we have to try and work around. It is certainly possible there are completely valid reasons to know this – so please tell me!

0 Likes

#116

Ok, I’ll look into getting my Windows 7 VM to run at HiDPI and check it out.

0 Likes

#117

I wanted to know when we where in hidpi mode so I could divide line_height by 2, but sense this will be addressed, this is no longer needed. I wasn’t sure if this would be addressed directly or not. Thanks for looking into this!

0 Likes

#118

ColorHelper 2.2.0

Released Nov 5, 2016

  • New: Add support for stTheme and search cdata #59.
  • NEW: Workaround for Windows 10 HiDpi large image issue #61.
    See document for more info.
  • NEW: Added toggle support for left/right positioned previews #65.
    See document for more info.
  • FIX: Web Color insertion bug #62.
  • FIX: Preview duplication bug (hopefully – please report if not fixed) #57.
5 Likes

#119

:heart: thank you, I love this one!
And, by the way, I immediately set it to “right” :wink:

0 Likes

#120

You’re welcome :slightly_smiling:.

0 Likes

#121

I like the way your changelog works - very clever use of mdpopups and phantoms, and disabling the gutter to make it seamless :wink:
I notice that the minimap doesn’t show phantoms though, which makes it a little harder to scroll/navigate. I wonder if we should raise a feature request with the ST devs that (certain?) phantoms should be able to be shown in the minimap?

1 Like

#122

Showing phantoms on the minimap would be a nice improvement. It would also help to make sections visible without putting super huge comments in the code.

2 Likes

#123

Yeah, that would be nice.

0 Likes

#124

Hi, I got a support question ?
How do you enable ColorHelper to handle YAML-tmTheme file ?

I’ve created a user settings file for the package in which I copied the original “color_scanning” list.
I then appended:

        {
            "syntax_files": [],
            "syntax_filter": "whitelist",
            "base_scopes": ["source.yaml"],
            "allowed_colors": ["hex", "hexa"],
            "extensions": ["YAML-tmTheme"],
            "use_hex_argb": true,
            "compress_hex_output": false
        }

But the little color squares doesn’t appear next to my theme colors.
Also why not provide support for this by default ?
And do I need to copy the whole list of existing scanners before appending mine ? It doesn’t seem very convenient.

0 Likes

#125

Because I originally supplied support for the default format. I am assuming this is PackageDev format? I don’t use PackageDev, so that is why it’s not in there. I am not against it being added though.

Yup, because I haven’t gotten around to changing it yet. I’ve just been busy. When I have some free time, and I motivate myself to start refactoring these kinds of things, stuff like this will change. To be honest, this whole plugin is going to go through some major refactoring, but time…and motivation…they fight against me at times :wink:.

As for your original question, I will probably answer it tonight when I have more time…

1 Like

#126

You should consider using CSScheme instead of PackageDev for color schemes. I find that to be vastly superior when utilizing preprocessors like SASS.

I use the following color_scanning settings:

{
    "color_scanning": [
        {
            "base_scopes": ["source.csscheme"],
            "scan_scopes": ["constant.other.color-hash"],
            "allowed_colors": ["hex", "hexa", "hex_compressed"],
            "use_hex_argb": false,
            "compress_hex_output": false
        },
        {
            "base_scopes": ["source.csscheme.scss"],
            "scan_scopes": ["meta.function, constant.other.color-hash"],
            "allowed_colors": ["css3", "hexa"],
            "use_hex_argb": false,
            "compress_hex_output": false
        },
        ...
    }
}

(doesn’t include X11 color names because fuck 'em)

3 Likes

#127

I agree with this. Since now themes can have web colors in pop-up css, and then X11 colors in the main body, it just complicates things.

0 Likes

#128

Ah right, CSScheme doesn’t support popupCss and phantomCss yet. Should be easy enough to add though.

0 Likes

#129

Hi @facelessuser

I noticed that colorhelper has being displaying phantoms and popups perfectly on my win10 4k screen.
I don’t know since which version did that start to happen (hadn’t been doing CSS lately), but I thank you so much for fixing that, and all the effort you put into other packages you maintain.

:heart: :heart: :heart:

Many many thanks,
Po

0 Likes

#130

Yeah, there has been a couple bug fix releases addressing phantom render issues. Glad it’s working better for you!

0 Likes

#131

@facelessuser, I’m having the issue with larger than normal images. The setup is a Virtualbox VM with Ubuntu 16.04 guest and Windows 10 host (4k). The temporary fix works to correct it in the host but not the guest. This is just fyi, it’s probably too much effort to revisit a temp fix at this point. I’m ok with waiting for your permanent solution but I wanted to let you know just in case it was relevant to your development.

0 Likes