Editing the color scheme

From Agar

Jump to: navigation, search
little modified demos/themes
transparent with checking for window focus

The easiest way of creating your own color scheme is using the themes demo. Look for demos/themes/ in the Agar distribution. Look for File / Preferences. Under the Colors tab, you can tweak the color scheme.

The color for "Window background" effectively allows you to create transparent windows. The slider at the bottom of the color picker widget allows the alpha component to be varied. Note that if using "multiple-window" drivers (such as glx or wgl), where Agar interfaces with an existing window system, transparent windows may or may not be available. Transparent windows are always available under "single-window" drivers such as sdlgl or sdlfb. Note that under unaccelerated frame-buffer modes such as sdlfb, transparency will result in significantly increased CPU usage.

Once you're satisfied with the color scheme, click on "Save scheme" to export the active color scheme to an .acs file. You can then load this file from your application like so:

/*
 * Minimal Agar application using a custom color scheme.
 */
#include <agar/core.h>
#include <agar/gui.h>
 
int
main(int argc, char *argv[])
{
        AG_Window *win;
 
        AG_InitCore("myname", 0);
        AG_InitGraphics(NULL);
        AG_ColorsLoad("mycolors.acs");
 
        win = AG_WindowNew(AG_WINDOW_PLAIN);
        AG_LabelNew(win, 0, "Custom color scheme...");
        AG_ButtonNew(win, 0, "foo");
        AG_WindowShow(win);
 
        AG_EventLoop();
        AG_Destroy();
        return (0);
}

Besides the color scheme, the appearance of GUI elements may be more dramatically modified using custom themes.

See also

Personal tools