[TxMt] Re: showing preview of css colors

Allan Odgaard mailinglist at textmate.org
Tue May 31 08:44:01 UTC 2016


On 31 May 2016, at 0:31, Carpii UK wrote:

> I know some bundles use ruby or node, but with CSS being a core bundle 
> I'm
> not sure if you try to reduce runtime dependencies?

Yes, we prefer to have things work out-of-the-box. So you could use PHP, 
but node is not feasible.

> What are your thoughts when a line has more than one color....
> border-color: #F00 #0F0 #00F #FF0;
>
> I could either just output the first color and discard the rest
> Or I could output them all, in reverse order (maybe for future use 
> somehow?)
> This would mean they are all included, but the first color ends up
> overwriting the latter ones in the gutter.

If you obtain the column offset then just set all of them and let 
TextMate figure it out :)

Right now I think it’ll show the one with the lowest column offset.

I’m not against an API to embed things into the editor, so good to 
keep an open mind toward future adaptation of the command.

> Safe to just hardcode this path relative to ~/ ?
> Or should I be basing it on some $TM_ENV_VAR ?

I would “hardcode” it, since ~/Library/Caches is the system cache 
directory and `com.macromates.textmate.colors` would be our “key” 
under which we store our images in this cache.

> Should I namespace my 'colors' dir to include a bundle name subdir?

I think using `com.macromates.textmate.colors` is enough. You can make 
the last component `css-colors` but I’m thinking the same command 
might handle multiple formats, or if we have different commands for CSS, 
SCSS, etc. then they benefit from using the same cache, and there is no 
issue with the SCSS command clearing colors in the CSS namespace, since 
one file will only be operated on by one of the commands.


More information about the textmate mailing list