I'm going to take a stab at writing this one up this weekend, but before that I'm wondering if anyone else would find this useful or has already done similar (or knows of an even more productive way...).
I've usually got a handful of colors that I use throughout a stylesheet; I'd say around 3-6 and that's about it. I'm thinking that a tab-complete on hex color values already in your stylesheet would be ridiculously helpful. so 'border-bottom: 1px solid #[tab]' would spit out a menu of all the colors already in your stylesheet as hex values.
Even more sick would be identifying each item with their color somehow, either by coloring the menu items (would suck w/ whites, greys) or providing a box colorized next to each item indicating that color. Would this be feasible?
Thoughts or suggestions would be great.
On Jul 21, 2006, at 11:23 AM, Eric D. Fields wrote:
I'm going to take a stab at writing this one up this weekend, but before that I'm wondering if anyone else would find this useful or has already done similar (or knows of an even more productive way...).
I've usually got a handful of colors that I use throughout a stylesheet; I'd say around 3-6 and that's about it. I'm thinking that a tab-complete on hex color values already in your stylesheet would be ridiculously helpful. so 'border-bottom: 1px solid #[tab]' would spit out a menu of all the colors already in your stylesheet as hex values.
That should be very easy to do. In ruby it would probably take about 6-7 lines, counting loading of the library dialog.rb for the dialogs. Though perhaps a simpler way is using completion. For that you'll just need to find out what the scope is after the #, ideally a unique scope not occurring anywhere else. Then you create a preference item that does completion by returning as the list of colors to complete the list provided by scanning the document. More on that here: http:// macromates.com/textmate/manual/preferences_items#completions
An even easier approach is already there if # is considered as a word character. If you go to the preferences menu, under Text Editing, and add # as a word character, then just pressing escape after the # should already complete with respect to all colors in the stylesheet.
Even more sick would be identifying each item with their color somehow, either by coloring the menu items (would suck w/ whites, greys) or providing a box colorized next to each item indicating that color. Would this be feasible?
That is not easily feasible atm, but it might be once dynamic scopes show up. The only way to do that now is to radically change the grammar, adding a separate rule for each color, and then adding colors for those rules in the theme. I would not particularly recommend this though. You could of course automate some part of it, but the resulting grammar would be huge. Not sure what the implications of this would be in terms of performance.
Thoughts or suggestions would be great.
-- eric
Haris
Eric,
If someone else hasn't already done it, please do this as I definitely could use it as well and it would be immensely helpful (makes we still wish CSS had "constants" for this kind of thing).
I don't have specific suggestions, but what you describes would work for me.
Regards, -Bob
On Jul 21, 2006, at 12:23 PM, Eric D. Fields wrote:
I'm going to take a stab at writing this one up this weekend, but before that I'm wondering if anyone else would find this useful or has already done similar (or knows of an even more productive way...).
I've usually got a handful of colors that I use throughout a stylesheet; I'd say around 3-6 and that's about it. I'm thinking that a tab-complete on hex color values already in your stylesheet would be ridiculously helpful. so 'border-bottom: 1px solid #[tab]' would spit out a menu of all the colors already in your stylesheet as hex values.
Even more sick would be identifying each item with their color somehow, either by coloring the menu items (would suck w/ whites, greys) or providing a box colorized next to each item indicating that color. Would this be feasible?
Thoughts or suggestions would be great.
-- eric
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On Jul 21, 2006, at 12:23 PM, Eric D. Fields wrote:
I've usually got a handful of colors that I use throughout a stylesheet; I'd say around 3-6 and that's about it. I'm thinking that a tab-complete on hex color values already in your stylesheet would be ridiculously helpful. so 'border-bottom: 1px solid #[tab]' would spit out a menu of all the colors already in your stylesheet as hex values.
Even more sick would be identifying each item with their color somehow, either by coloring the menu items (would suck w/ whites, greys) or providing a box colorized next to each item indicating that color. Would this be feasible?
Thoughts or suggestions would be great.
eric
How about doing an HTML Output window? You could program one that shows all the colors in your document in their colors. Then when you click on one of them it pastes the color at at cursor location and closes the HTML Output window.
Allan changed the way some of that stuff works now. You can have javascript in the HTML Output window call a shell script that calls applescript to insert text without crashing the app now.
Or is that overkill?
thomas Aylott—subtleGradient
On Jul 21, 2006, at 2:44 PM, thomas Aylott wrote:
On Jul 21, 2006, at 12:23 PM, Eric D. Fields wrote:
I've usually got a handful of colors that I use throughout a stylesheet; I'd say around 3-6 and that's about it. I'm thinking that a tab-complete on hex color values already in your stylesheet would be ridiculously helpful. so 'border-bottom: 1px solid #[tab]' would spit out a menu of all the colors already in your stylesheet as hex values.
Even more sick would be identifying each item with their color somehow, either by coloring the menu items (would suck w/ whites, greys) or providing a box colorized next to each item indicating that color. Would this be feasible?
Thoughts or suggestions would be great.
eric
How about doing an HTML Output window? You could program one that shows all the colors in your document in their colors. Then when you click on one of them it pastes the color at at cursor location and closes the HTML Output window.
Allan changed the way some of that stuff works now. You can have javascript in the HTML Output window call a shell script that calls applescript to insert text without crashing the app now.
Or is that overkill?
thomas Aylott—subtleGradient
It's not as instantly responsive as I would like, but you get what you pay for :P
http://pastie.caboo.se/5488  thomas Aylott—subtleGradient
Yeah... that's not as elegant as what i was thinking. I'm not looking to do an html pop-up window because then you're jumping back to the mouse to get what you want. I suppose you could tab through the links, but i'm going to start out w/ the initial menu item i described earlier.
On 7/21/06, thomas Aylott thomas.42@gmail.com wrote:
On Jul 21, 2006, at 2:44 PM, thomas Aylott wrote:
On Jul 21, 2006, at 12:23 PM, Eric D. Fields wrote: I've usually got a handful of colors that I use throughout a stylesheet; I'd say around 3-6 and that's about it. I'm thinking that a tab-complete on hex color values already in your stylesheet would be ridiculously helpful. so 'border-bottom: 1px solid #[tab]' would spit out a menu of all the colors already in your stylesheet as hex values.
Even more sick would be identifying each item with their color somehow, either by coloring the menu items (would suck w/ whites, greys) or providing a box colorized next to each item indicating that color. Would this be feasible?
Thoughts or suggestions would be great.
eric
How about doing an HTML Output window? You could program one that shows all the colors in your document in their colors. Then when you click on one of them it pastes the color at at cursor location and closes the HTML Output window.
Allan changed the way some of that stuff works now. You can have javascript in the HTML Output window call a shell script that calls applescript to insert text without crashing the app now.
Or is that overkill?
thomas Aylott—subtleGradient
It's not as instantly responsive as I would like, but you get what you pay for :P
thomas Aylott—subtleGradient
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate