[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Do Re Mi (was: Q on Text Properties popup menu - shouldn'titusethepointe

From: Drew Adams
Subject: Do Re Mi (was: Q on Text Properties popup menu - shouldn'titusethepointerposition, not the cursor position?)
Date: Mon, 27 Jun 2005 15:41:22 -0700

        I also added items "Change Face Foreground", "Change Face
        Background", and "Change Face Attribute" to the menu. The
        first two let you change a face incrementally (using the
        arrow keys or mouse wheel). Using the C-mouse-2 popup menu,
        you can just point to some text that has a face and change the
        face's colors incrementally. No need to know the face name or color
        names/values beforehand: just point and tweak.

    That is completely unrelated to changing the text properties of some
    text, but it could be a useful feature, if it makes face customization
    really easy.  Can you describe the interface?  How do you use the
    mouse to change a color?  Colors are in a 3-dimensional space,
    and the mouse moves only in two dimensions.

Right; it is unrelated, except that it is a way to change the foreground and
background properties of a face or a frame.

I mentioned the incremental-change behavior previously (search for "doremi"
in archive for Nov or Dec 2004). A writeup is here:
http://www.emacswiki.org/cgi-bin/wiki/DoReMi. The same technique is used for
resizing and moving frames, zooming frames (font size), and cycling through
buffers, bookmarks, marks, or color themes, and other incremental or cyclic
changes. The idea is to (re)use the arrow keys for different commands.

Here's what the user experiences (it's easier to try it than to explain it,

1. C-mouse-2 on text in, say, face `font-lock-comment'.
Choose "Change Face Foreground" in the popup "Text Properties" menu.

Alternatively, use `M-x doremi-face-fg'; that command prompts you for the
face to change.

2. Prompt appears in minibuffer:

"Change foreground of `font-lock-comment'. Adjust red, green, blue, hue,
saturation, or value? [rgbhsv]"

3. Enter one of the characters [rgbhsv]. Let's say you enter `r', for
incrementing/decrementing the red color component.

Note 1: You can do this (change color component) at any time during
incremental color change (step 4). For example, if you are incrementing the
red color component and you hit `v', then you switch immediatly to
incrementing the value color component. This is very useful; in effect, it
means that you need not reason in terms of RGB or HSV. A combination of
value changes and RGB changes, for instance, is often handy. You need not
think at all, in fact: just adjust a component to see what it does -
WYSIWYG. You can quickly obtain the color you want.

Note 2: The increment is set by default so as to give you a reasonable
change with each incrementation. You can change the increment, however, to
give you as fine control of the color as you need.

Note 3: Color models RGB, HSV, and CMY are handled. Color components cyan,
magenta, and yellow are just the opposite of components red, green, and
blue, respectively. Incrementing one is the same as decrementing the other.
So, for instance, if you want to increment magenta, just decrement (down
arrow) green.

4. Prompt appears in minibuffer:

"Use up, down, or mouse wheel to adjust value (modifier key: faster). Value
now: Firebrick"

or whatever your current foreground value of `font-lock-comment' is - mine
is Firebrick.

5. Use the up or down key, or the mouse wheel, to increment or decrement the
current red value. The foreground property of the face is changed - you can
see the result immediately on any buffers showing that face.

After each up/down/wheel action, the prompt echoes the (new) current value.
Color values are from now on expressed in the hex form #RRRRGGGGBBBB (red,
green, blue). For example, the prompt looks like this after hitting the up
arrow once:

"Use up, down, or mouse wheel to adjust value (modifier key: faster). Value
now: #B3B222222222"

After hitting the up arrow again, this is the prompt:

"Use up, down, or mouse wheel to adjust value (modifier key: faster). Value
now: #B4B222222222"

You can just hold down an arrow key to repeat its action and keep
incrementing. The echoed value is updated accordingly - just watch it spin
like an odometer. You can go back and forth with the up and down keys, until
you get just what you want.

If you hold down a modifier key (by default, `Meta') while using the arrow
keys or mouse wheel, then the incrementation is boosted: the increment is
larger. Use it to get quickly in the neighborhood of the color you want. The
prompt text "(modifier key: faster)" indicates this possibility. Do Re Mi
commands (such as `doremi-bookmarks') that cycle through enumerations,
instead of incrementing numerical values, do not have this modifier
behavior, with its prompt.

Note: Other Do Re Mi commands use all four arrows, if appropriate. For
instance, a command for resizing frames lets you use all four to grow/shrink
both width and height. This is actually accomplished by having two Do Re Mi
commands, one for each dimension, bound to up/down and left/right arrows
respectively. Each command calls the other at the end, if the other's arrows
are used. The user just seamlessly uses any of the four arrows, without
exiting from the initial command.

6. When you finally get the color you want, just do anything other than
[rgbhsv], up, down, or mouse-wheel, to exit. This message then appears in
the echo area:

"Use `customize-customized' to revisit changes."

The updated value is communicated to Customize, so it will show that the
face foreground was "set" in Customize (i.e. it cheats) and it can be saved

reply via email to

[Prev in Thread] Current Thread [Next in Thread]