[ANN] Color Browser 0.2.0

I've made some enhancements to the Color Browser plugin. The biggest change is a complete rework of the all the buttons for inserting a color into an editor. Going on the assumption that a single format will typically be used for any given project I have made it easier to pick a single format and easily insert colors in that format. Of course you can still pick any format you wish.

Inserting a color into an editor now automatically replaces an existing color reference if the cursor is currently within a color reference.

Added support for javax.swing.plaf.ColorUIResource in addition to CSS/HTML and java.awt.Color.

Let you specify whether hex values should be in upper or lower case.

Thanks to Robert Beeger for many of these ideas.

Enjoy,
Rick

5 comments
Comment actions Permalink

Hi Rick,

Looks good. There's just one problem here: I get the following exception when pressing CTRL and moving the mouse cursor over a Color or ColorUIResource:
Error during dispatching of java.awt.event.MouseEvent[MOUSE_MOVED,(714,645),button=0,modifiers=Strg,extModifiers=Strg,clickCount=0] on frame0: String index out of range: 3
java.lang.StringIndexOutOfBoundsException: String index out of range: 3
at java.lang.String.charAt(Unknown Source)
at com.maddyhome.idea.color.search.SearchEngine.findColorMatch(SearchEngine.java:40)
at com.maddyhome.idea.color.ColorInfoPluginImpl.getHyperLinkRange(ColorInfoPluginImpl.java:130)
at com.maddyhome.idea.color.ColorInfoPluginImpl.access$300(ColorInfoPluginImpl.java:75)
at com.maddyhome.idea.color.ColorInfoPluginImpl$ControlHandler.mouseMoved(ColorInfoPluginImpl.java:337)
at com.intellij.openapi.editor.impl.EditorImpl$MyMouseMotionListener.mouseMoved(EditorImpl.java:6)
at java.awt.Component.processMouseMotionEvent(Unknown Source)
at javax.swing.JComponent.processMouseMotionEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:9)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:39)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:57)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

0
Comment actions Permalink

Oops - I just released 0.2.1 which fixes this and a few other minor recongnition issues.

Thanks,
Rick

0
Comment actions Permalink

I just tried out the Color Browser and it's very nice.

One thing I noticed was that when I put the cursor on a HEX color like "#F4F2FC", when I pressed the CURSOR button in Color Browser, it would show #FFF in the combobox. If I check the ComboBox, the 2nd item in the list is #F4F2FC, Shouldn't it have shown this by default?

Hm.. now I see after playing with it once I select the 2nd choice #F4F2FC; in the combobox, then in the future whenever I pick another color from the editor it continues to show the #XXXXXX HEX insead of #XXX. So, it's not that big a deal.

One bug/problem I did find was when I pressed CTRL+mouseover on a color in a CSS file, the tooltip with the color info would pop up for less than a second and immediately pop back down, so I could barely read it. Does this popup stay up for you? I couldn't get it to work.

One thing I would really like is a palette which I could save with my project / module.
Another way to load a palette of colors would be to scan a file (e.g. CSS file) and pickout all the unique colors and display them.

Attached is a picture of the CSS Palette Editor in Top Style. It scans the CSS file
and displays all unique colors in a palette. Each color also displays all the styles
which refer to it.

Another color related request that would be really useful is to color the background color definitions in a CSS or Java file w/ the specified color. See attached for a mockup.



Attachment(s):
topstyle310_css_palette_editor.gif
css_color_style.gif
0
Comment actions Permalink

The idea behind the three drop down lists is that you select your preferred format once and leave it. The selection is stored in the project file so it is remembered. Maybe I'll look into an enhancement that if you haven't explicitly picked a format then the first time you click the Cursor button the drop down list will match the format of the selected text.

You are the second person to report the "quickly disappearing pop-up". For me, under OS X and Linux, the pop-up stays up as long as I hold down the Ctrl key. Are you releasing the Ctrl key or are you holding it down?

I'll look into your two requests. I've gotten pretty busy again since I wrote this plugin so please don't expect anything soon.

Thanks for the feedback.

Rick

0
Comment actions Permalink

Hi Rick,

The problem is that under Windows the CTRL-modifier is used for "Brief Info". On a Mac the Option key is used as the modifier for this function. Also CTRL-clicking something opens it in an editor. On a Mac it's Option-clicking.

So on Windows ColorBrowsers key setting is clashing with "Brief Info". On Windows CTRL-clicking on a color opens ColorBrowser with the color under the cursor. On a Mac that won't ever work since a CTRL-click is simulating the right-click.

So it isn't working right neither on Windows nor on Mac OSX.
There are two solutions:
1. Either you somehow make it work as a "Brief Info" enhancement. Don't know if that's possible, but that would be the best thing.
2. Take a key that will work on both Windows and Mac -Alt-mouse-over and Alt-click don't seem to be used.

Cheers,
Robert

0

Please sign in to leave a comment.