So, I have already seen a few people not entirely happy with the way I implementing coloring of groups in the newest Reggy release. I figured I would just give my view of what I did and why.
My goal with Reggy from the beginning was to be simple and not look like junk. There are many other regular expression testers out there. If you like them, use them. I happen to think many of them look like dirt. Reggy may not be gorgeous, but it’s certainly not dirt either.
The first implementation of coloring was actually by a volunteer (Justin Bakse) who was nice enough to pass the code back to me to look over. It was a good start for sure. But it used an implementation that I just don’t want —- for simplicity’s sake: you pick X amount of colors, then for each match the code picks one of the colors, then the next and so on, repeating. This is visually distinctive if you pick a bunch of crazy colors, but I am still thinking that picking 10 colors in the preferences is not the Mac experience I want to provide for people.
My implementation looks like this:
// Add new color to matched ranges
bool countUp = YES;
float r,g,b,a;
[[NSUnarchiver unarchiveObjectWithData:[[NSUserDefaults standardUserDefaults] objectForKey:@"match_color"]] getRed:&r green:&g blue:&b alpha:&a];
for ( unsigned int i = 0; i < [matchedRanges count]; i++ )
{
NSRange thisRange = NSRangeFromString([matchedRanges objectAtIndex:i]);
// Generate new color from base color
if ( i > 0 && [[NSUserDefaults standardUserDefaults] boolForKey:@"color_submatches"] )
{
if ( r > 0.8 || g > 0.8 || b > 0.8 ) countUp = NO;
if ( r < 0.0 || g < 0.0 || b < 0.0 ) countUp = YES;
if ( countUp ) { r += 0.2; g += 0.2; b += 0.2; } else { r -= 0.2; g -= 0.2; b -= 0.2; }
}
[[testingStringField textStorage] addAttribute:NSForegroundColorAttributeName value:[NSColor colorWithCalibratedRed:r green:g blue:b alpha:a] range:thisRange];
}
Pretty simple I think. Get the color components of the match string color preference (r, g, b, a). Then for every match other than the first match, increment each RGB component by 20% (this is a 0 to 1 scale) or decrement depending on the component values. I came out with 0.8 as a maximum value by just testing a bunch of different match colors and found 0.8 to be around the acceptable range of readability against a white background for most colors. The increment or decrement step value of 0.2 was another value I just played around with until there was a good balance between having each color step look different, yet still provide a small enough value so as to allow as many steps as possible between 0 and 1.
If anyone has a more elegant solution, please propose it. I am not a genius, I just know what I like. And I don’t like having to pick a bunch of colors. I like the simplicity of using one color with differing brightness as it still seems that the user has control over the coloring, but maybe I could go for a color generation scheme that is based on color theories like complements or triads. Or maybe I am the only one that is this picky?
Filed under wp-import code opensource reggy
I pushed out a new version of Reggy this morning.
Release Notes:
- added preference to apply sub-match/capture group coloring: each match or capture group gets a slightly different shade of color —- especially nice for nesting matches
- added preference to automatically use the clipboard contents on startup for the regular expression and/or the testing string
- added menu items to paste the clipboard directly into either the regular expression (Command Shift V) or the testing string (Command Option V)
- added a new and improved Reggy icon (Leopard Compatible/Resolution Independent)
- added help link for regular expression syntax preference (goes to wikipedia)
- updated regular expression engine
- simplified preferences window
Thanks should go to Steve Huff at the Harvard-MIT Data Center for requesting the startup clipboard preferences. It was a great idea that, along with the menu items to quickly paste into the fields, many people will be happy to see.
So anyways, Leopard’s icon size is big, and I mean big:

I had to redraw the icon this morning because the clipping icon I was using was swiped from Tiger. I figured it would probably be proper of me to not steal the clipping icon.
I am really excited to get onto developing a Leopard-only 2.0 version. I am starting to read through the new documentation now. Let me just say thank you to Apple for making developing stuff like Reggy fun and easy.
Filed under wp-import icon leopard opensource osx reggy update
TO HATE.
Those who use the newest of Adobe’s Creative Suites on old hardware (a 1Ghz PowerBook G4 for me) can sympathize I am sure.
My laptop is getting old, yes I know. But Adobe, your updater application slows my computer down more than Photoshop and Illustrator do! Now, I am kind of used to slow these days, so I normally wouldn’t complain too much if it weren’t for the craziness I witnessed this afternoon after rebooting from the latest system updates from Apple.
I was never happy with Adobe Updater, so I normally tell it to go away when it does come up. Given that, I had an update to install — Acrobat 8.1 Update. Fine, I just restarted, so I’ll let it go through before I start back on my work.
Maybe not a good idea.
Steps to update Acrobat 8 Professional
- Hit update on the Adobe Updater. (My CPU and HD will now be pegged for the install, Okay I am used to that.)
Waiting about 10-15 minutes…

- The install is seemingly 90% completed or so. Now a dialog comes up that says some items need “repaired”. Items like the Safari PDF Plugin, eww, no thanks — too slow. So I uncheck that and let it go to town “repairing the PDF Printer”.
Woops, I see a dialog that says “Wait For App Shutdown Title” — “Please click OK when other apps have stopped” with both Cancel and OK buttons. What? Wait a moment, wait for what app to stop? The updater? Because that’s the only app really running in the Dock. Confused, I click OK.
It returns. I click OK, again… I see a pattern emerging here.

After a few bouts of click madness just for fun, I click Cancel. I have no idea what that means. The dialog doesn’t read well obviously. Cancel could mean destroy the computer immediately for all I know.
But then it works. Five minutes later, I am greeted with this screen:

- Looking at Acrobat’s information in Finder it is indeed updated to
8.1.0.
Utterly slow, confusing and just plain bad Adobe, for-shame.
UPDATE: Looks like Gus Mueller loves the updater too. Thanks for the links Daniel.
Filed under wp-import acrobat adobe fail updater
Filed under wp-import osx reggy screenshot
Are you ready for it?
So, now we have an appcast for you to follow on the new Reggy website. Did some last minute tweaks to make me happy and now it is up on the servers, so go get it!
- added user preferences
- matched string highlight color
- regular expression options
- regular expression syntax
- check for automatic updates
- added automatic updates using the Sparkle framework
I hope you like the update. As always, feel free to file bug reports and feature requests on the issue tracker.
I plan on posting a bit of what I see for the future of Reggy soon for those who may be interested.
Filed under wp-import appcast opensource reggy update