~\newline
 

This example shows how to manipulate and change Color classes. In this example we will create two surfaces to show what happens when you change the color class at the process and object level.

It\textquotesingle{}s a very simple example, there are two surfaces created from the same E\+DC, but just in one of them we will set a specific color class, although both will be affected by color class set at the process level as you will see.

It\textquotesingle{}s important you know that all colors has the format R G B A. Just to be easier to understand this example, we will create a small set of colors that will be used along of the example. This piece of code is shown below\+: 
\begin{DoxyCodeInclude}
\textcolor{keyword}{static} color colors\_init\_data[] =
  \{\{255, 0, 0, 255\},            \textcolor{comment}{/* red */}
   \{0, 255, 0, 255\},            \textcolor{comment}{/* green */}
   \{0, 0, 255, 255\},            \textcolor{comment}{/* blue */}
   \{0, 0, 0, 255\},              \textcolor{comment}{/* black */}
   \{255, 255, 255, 255\},        \textcolor{comment}{/* white */}
   \{128, 128, 128, 255\},        \textcolor{comment}{/* gray */}
   \{255, 255, 0, 255\},          \textcolor{comment}{/* yellow */}
   \{255, 0, 255, 255\}           \textcolor{comment}{/* pink */}
  \};

\textcolor{keyword}{static} \textcolor{keywordtype}{char} *color\_names[] =
  \{\textcolor{stringliteral}{"red"}, \textcolor{stringliteral}{"green"}, \textcolor{stringliteral}{"blue"}, \textcolor{stringliteral}{"black"}, \textcolor{stringliteral}{"white"},
   \textcolor{stringliteral}{"gray"}, \textcolor{stringliteral}{"yellow"}, \textcolor{stringliteral}{"pink"}\};

\textcolor{keyword}{static} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}
\_get\_color\_from\_name(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *n, color *c)
\{
   \textcolor{keywordtype}{int} i;
   \textcolor{keywordflow}{for} (i = 0; i < 8; i++)
     \textcolor{keywordflow}{if} (!strcmp(n, color\_names[i]))
       \{
          (*c)[0] = (colors\_init\_data[i])[0];
          (*c)[1] = (colors\_init\_data[i])[1];
          (*c)[2] = (colors\_init\_data[i])[2];
          (*c)[3] = (colors\_init\_data[i])[3];
          \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};
       \}

   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};
\}

\end{DoxyCodeInclude}


Focusing on the relevant parts of the code we go right to the part where we set the new color class. For that we will use the functions edje\+\_\+color\+\_\+class\+\_\+set ( which will affect all edjes) and edje\+\_\+object\+\_\+color\+\_\+class\+\_\+set (which affects just the specific object). 
\begin{DoxyCodeInclude}
   \mbox{\hyperlink{group__Edje__Object__Color__Class_ga684435de625bdbb996e405e3eaaa54ad}{edje\_color\_class\_set}}(argv[1],                     \textcolor{comment}{/* class name   */}
                        c1[0], c1[1], c1[2], c1[3],  \textcolor{comment}{/* Object color */}
                        c2[0], c2[1], c2[2], c2[3],  \textcolor{comment}{/* Text outline */}
                        c3[0], c3[1], c3[2], c3[3]); \textcolor{comment}{/* Text shadow  */}

   \textcolor{comment}{/* Setting an arbitrary value just to see the difference between */}
   \textcolor{comment}{/* process level and object level */}
   edje\_object\_color\_class\_set(edje\_obj2, argv[1], \textcolor{comment}{/* class name   */}
                               128, 180, 77, 255,  \textcolor{comment}{/* Object color */}
                               200, 22, 86, 255,   \textcolor{comment}{/* Text outline */}
                               39, 90, 187, 255);  \textcolor{comment}{/* Text shadow  */}

\end{DoxyCodeInclude}
 \begin{DoxyNote}{Note}

\begin{DoxyItemize}
\item argv\mbox{[}1\mbox{]} is the name of a color class used in the E\+DC.
\item The second and third colors only apply to text part.
\item The color class set for the object overrides the color previously set.
\end{DoxyItemize}
\end{DoxyNote}
After we have set the color class we will check the color classes, for that we created a function which prints all color classes and tries to get theirs values and print too.  
\begin{DoxyCodeInclude}
\_color\_classes\_print(\textcolor{keywordtype}{void})
\{
   \mbox{\hyperlink{struct__Eina__List}{Eina\_List}} *classes;
   \textcolor{keywordtype}{char} *class\_name;

   printf(\textcolor{stringliteral}{"Getting the color classes\(\backslash\)n\(\backslash\)n"});
   classes = \mbox{\hyperlink{group__Edje__Object__Color__Class_gac9de6885daf1eea7d3f6e3e822a4ca65}{edje\_color\_class\_list}}();
   \mbox{\hyperlink{group__Eina__List__Group_gae27a2c686a0a11693f9b06957c9bba83}{EINA\_LIST\_FREE}}(classes, class\_name)
     \{
        \textcolor{keywordtype}{int} r1, r2, r3, g1, g2, g3, b1, b2, b3,
          a1, a2, a3;

        printf(\textcolor{stringliteral}{"\(\backslash\)ncolor class: %s\(\backslash\)n"}, class\_name);
        \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Edje__Object__Color__Class_gaf4e14706bc9766011ca60862f057d56e}{edje\_color\_class\_get}}(class\_name, &r1, &g1, &b1, &a1,
                                  &r2, &g2, &b2, &a2, &r3, &g3, &b3, &a3))
          fprintf(stderr, \textcolor{stringliteral}{"Cannot get the color class\(\backslash\)n"});
        \textcolor{keywordflow}{else}
          \{

             printf(\textcolor{stringliteral}{"Object color r: %d g: %d b: %d a: %d\(\backslash\)n"},
                     r1, g1, b1, a1);
             printf(\textcolor{stringliteral}{"Text outline color r: %d g: %d b: %d a: %d\(\backslash\)n"},
                     r2, g2, b2, a2);
             printf(\textcolor{stringliteral}{"Text shadow color r: %d g: %d b: %d a: %d\(\backslash\)n"},
                     r3, g3, b3, a3);
          \}
        free(class\_name);
     \}
\}

\end{DoxyCodeInclude}


There are two other things that are worth mentioning, we added two callbacks for the objects, one for mouse down (that we use to delete the color class) and another for the signal emitted when a color class is deleted. 
\begin{DoxyCodeInclude}
   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(edje\_obj1, 
      \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a9fa52651ccf7e47cd3b7785fc4cf393f}{EVAS\_CALLBACK\_MOUSE\_DOWN}},
                                  \_on\_mouse\_down, NULL);
   edje\_object\_signal\_callback\_add(edje\_obj1, \textcolor{stringliteral}{"color\_class,del"}, \textcolor{stringliteral}{"*"},
                                   (Edje\_Signal\_Cb) \_color\_class\_callback\_delete,
                                   \textcolor{stringliteral}{"process"});

\end{DoxyCodeInclude}


And then we delete the color class\+:  
\begin{DoxyCodeInclude}
\_on\_mouse\_down(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *e \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, 
      \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj, \textcolor{keywordtype}{void} *event\_info)
\{
   \mbox{\hyperlink{struct__Evas__Event__Mouse__Down}{Evas\_Event\_Mouse\_Down}} *ev = event\_info;

   \textcolor{keywordflow}{if} (ev->\mbox{\hyperlink{struct__Evas__Event__Mouse__Down_a0ab02808721d6c55fc642ecbb37d5ff9}{button}} == 1)
     \{
        \textcolor{keywordflow}{if} (obj == edje\_obj1)
          \mbox{\hyperlink{group__Edje__Object__Color__Class_ga0d30416497554e3f50c893de5c0cccad}{edje\_color\_class\_del}}(selected\_class);
        \textcolor{keywordflow}{else}
          edje\_object\_color\_class\_del(edje\_obj2, selected\_class);
     \}

\end{DoxyCodeInclude}


Our example will look like this, if you run with the parameters \char`\"{}green\+\_\+class gray pink yellow\char`\"{}\+:

  
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{edje-color-class-example}}
\end{DoxyImageNoCaption}
 ~\newline
   
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{edje-color-class-example2}}
\end{DoxyImageNoCaption}


The full source code follows\+: 
\begin{DoxyCodeInclude}

\textcolor{preprocessor}{#ifdef HAVE\_CONFIG\_H}
\textcolor{preprocessor}{# include "config.h"}
\textcolor{preprocessor}{#else}
\textcolor{preprocessor}{# define EINA\_UNUSED}
\textcolor{preprocessor}{#endif}

\textcolor{preprocessor}{#ifndef PACKAGE\_DATA\_DIR}
\textcolor{preprocessor}{#define PACKAGE\_DATA\_DIR "."}
\textcolor{preprocessor}{#endif}

\textcolor{preprocessor}{#include <Ecore.h>}
\textcolor{preprocessor}{#include <\mbox{\hyperlink{Ecore__Evas_8h}{Ecore\_Evas.h}}>}
\textcolor{preprocessor}{#include <\mbox{\hyperlink{Edje_8h}{Edje.h}}>}

\textcolor{preprocessor}{#define WIDTH  (400)}
\textcolor{preprocessor}{#define HEIGHT (400)}

\textcolor{keyword}{typedef} \textcolor{keywordtype}{int} color[4];           \textcolor{comment}{/* rgba */}

\textcolor{keyword}{static} Ecore\_Evas *ee1, *ee2;
\textcolor{keyword}{static} \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *evas1, *evas2;
\textcolor{keyword}{static} \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *bg1, *edje\_obj1, *bg2, *edje\_obj2;
\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *selected\_class;

\textcolor{keyword}{static} color colors\_init\_data[] =
  \{\{255, 0, 0, 255\},            \textcolor{comment}{/* red */}
   \{0, 255, 0, 255\},            \textcolor{comment}{/* green */}
   \{0, 0, 255, 255\},            \textcolor{comment}{/* blue */}
   \{0, 0, 0, 255\},              \textcolor{comment}{/* black */}
   \{255, 255, 255, 255\},        \textcolor{comment}{/* white */}
   \{128, 128, 128, 255\},        \textcolor{comment}{/* gray */}
   \{255, 255, 0, 255\},          \textcolor{comment}{/* yellow */}
   \{255, 0, 255, 255\}           \textcolor{comment}{/* pink */}
  \};

\textcolor{keyword}{static} \textcolor{keywordtype}{char} *color\_names[] =
  \{\textcolor{stringliteral}{"red"}, \textcolor{stringliteral}{"green"}, \textcolor{stringliteral}{"blue"}, \textcolor{stringliteral}{"black"}, \textcolor{stringliteral}{"white"},
   \textcolor{stringliteral}{"gray"}, \textcolor{stringliteral}{"yellow"}, \textcolor{stringliteral}{"pink"}\};

\textcolor{keyword}{static} \mbox{\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool}}
\_get\_color\_from\_name(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *n, color *c)
\{
   \textcolor{keywordtype}{int} i;
   \textcolor{keywordflow}{for} (i = 0; i < 8; i++)
     \textcolor{keywordflow}{if} (!strcmp(n, color\_names[i]))
       \{
          (*c)[0] = (colors\_init\_data[i])[0];
          (*c)[1] = (colors\_init\_data[i])[1];
          (*c)[2] = (colors\_init\_data[i])[2];
          (*c)[3] = (colors\_init\_data[i])[3];
          \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}};
       \}

   \textcolor{keywordflow}{return} \mbox{\hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE}};
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_color\_classes\_print(\textcolor{keywordtype}{void})
\{
   \mbox{\hyperlink{struct__Eina__List}{Eina\_List}} *classes;
   \textcolor{keywordtype}{char} *class\_name;

   printf(\textcolor{stringliteral}{"Getting the color classes\(\backslash\)n\(\backslash\)n"});
   classes = \mbox{\hyperlink{group__Edje__Object__Color__Class_gac9de6885daf1eea7d3f6e3e822a4ca65}{edje\_color\_class\_list}}();
   \mbox{\hyperlink{group__Eina__List__Group_gae27a2c686a0a11693f9b06957c9bba83}{EINA\_LIST\_FREE}}(classes, class\_name)
     \{
        \textcolor{keywordtype}{int} r1, r2, r3, g1, g2, g3, b1, b2, b3,
          a1, a2, a3;

        printf(\textcolor{stringliteral}{"\(\backslash\)ncolor class: %s\(\backslash\)n"}, class\_name);
        \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Edje__Object__Color__Class_gaf4e14706bc9766011ca60862f057d56e}{edje\_color\_class\_get}}(class\_name, &r1, &g1, &b1, &a1,
                                  &r2, &g2, &b2, &a2, &r3, &g3, &b3, &a3))
          fprintf(stderr, \textcolor{stringliteral}{"Cannot get the color class\(\backslash\)n"});
        \textcolor{keywordflow}{else}
          \{

             printf(\textcolor{stringliteral}{"Object color r: %d g: %d b: %d a: %d\(\backslash\)n"},
                     r1, g1, b1, a1);
             printf(\textcolor{stringliteral}{"Text outline color r: %d g: %d b: %d a: %d\(\backslash\)n"},
                     r2, g2, b2, a2);
             printf(\textcolor{stringliteral}{"Text shadow color r: %d g: %d b: %d a: %d\(\backslash\)n"},
                     r3, g3, b3, a3);
          \}
        free(class\_name);
     \}
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_on\_destroy(Ecore\_Evas *ee \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})
\{
   \mbox{\hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}}();
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_on\_mouse\_down(\textcolor{keywordtype}{void} *data \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *e \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, 
      \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj, \textcolor{keywordtype}{void} *event\_info)
\{
   \mbox{\hyperlink{struct__Evas__Event__Mouse__Down}{Evas\_Event\_Mouse\_Down}} *ev = event\_info;

   \textcolor{keywordflow}{if} (ev->\mbox{\hyperlink{struct__Evas__Event__Mouse__Down_a0ab02808721d6c55fc642ecbb37d5ff9}{button}} == 1)
     \{
        \textcolor{keywordflow}{if} (obj == edje\_obj1)
          \mbox{\hyperlink{group__Edje__Object__Color__Class_ga0d30416497554e3f50c893de5c0cccad}{edje\_color\_class\_del}}(selected\_class);
        \textcolor{keywordflow}{else}
          edje\_object\_color\_class\_del(edje\_obj2, selected\_class);
     \}
\}

\textcolor{comment}{/* here just to keep our example's window size}
\textcolor{comment}{ * in synchrony. */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_canvas\_resize\_cb(Ecore\_Evas *\_ee)
\{
   \textcolor{keywordtype}{int} w, h;

   \mbox{\hyperlink{group__Ecore__Evas__Group_ga931aadf4603731e73e8a84e4b14f1493}{ecore\_evas\_geometry\_get}}(\_ee, NULL, NULL, &w, &h);

   \textcolor{keywordflow}{if} (\_ee == ee1)
     \{
        evas\_object\_resize(bg1, w, h);
        evas\_object\_resize(edje\_obj1, w, h);
     \}
   \textcolor{keywordflow}{else}
     \{
        evas\_object\_resize(bg2, w, h);
        evas\_object\_resize(edje\_obj2, w, h);
     \}
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_color\_class\_callback\_delete(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}} *e \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, 
      \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *obj \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}},
                             \textcolor{keyword}{const} \textcolor{keywordtype}{char} *emission, \textcolor{keywordtype}{void} *source \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})
\{
   \textcolor{keywordflow}{if} (!strcmp(data, \textcolor{stringliteral}{"process"}))
     printf(\textcolor{stringliteral}{"Color class: %s deleted on process level\(\backslash\)n"}, emission);
   \textcolor{keywordflow}{else}
     printf(\textcolor{stringliteral}{"Color class: %s deleted on object level\(\backslash\)n"}, emission);
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{int}
\_create\_windows(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *edje\_file\_path)
\{
  \textcolor{comment}{/* this will give you a window with an Evas canvas under the first}
\textcolor{comment}{    * engine available */}
   ee1 = \mbox{\hyperlink{group__Ecore__Evas__Group_gac7f2cdbcb79635c34317c1183dd04cb0}{ecore\_evas\_new}}(NULL, 0, 0, WIDTH, HEIGHT, NULL);
   \textcolor{keywordflow}{if} (!ee1)
     \textcolor{keywordflow}{return} 0;
   ee2 = \mbox{\hyperlink{group__Ecore__Evas__Group_gac7f2cdbcb79635c34317c1183dd04cb0}{ecore\_evas\_new}}(NULL, 0, 0, WIDTH, HEIGHT, NULL);
   \textcolor{keywordflow}{if} (!ee2)
     \textcolor{keywordflow}{return} 0;

   \mbox{\hyperlink{group__Ecore__Evas__Group_ga3680b5c89157167318192157a5d24ec4}{ecore\_evas\_callback\_destroy\_set}}(ee1, \_on\_destroy);
   \mbox{\hyperlink{group__Ecore__Evas__Group_gaac67f679c9027059a34519fbdea360df}{ecore\_evas\_callback\_resize\_set}}(ee1, \_canvas\_resize\_cb);
   \mbox{\hyperlink{group__Ecore__Evas__Group_ga3b2832e0373bbafae2bb7143618535c1}{ecore\_evas\_title\_set}}(ee1, \textcolor{stringliteral}{"Edje Color Class Example"});

   \mbox{\hyperlink{group__Ecore__Evas__Group_ga3680b5c89157167318192157a5d24ec4}{ecore\_evas\_callback\_destroy\_set}}(ee2, \_on\_destroy);
   \mbox{\hyperlink{group__Ecore__Evas__Group_gaac67f679c9027059a34519fbdea360df}{ecore\_evas\_callback\_resize\_set}}(ee2, \_canvas\_resize\_cb);
   \mbox{\hyperlink{group__Ecore__Evas__Group_ga3b2832e0373bbafae2bb7143618535c1}{ecore\_evas\_title\_set}}(ee2, \textcolor{stringliteral}{"Edje Object Color Class Example"});

   evas1 = \mbox{\hyperlink{group__Ecore__Evas__Group_ga75a7cc694b6069e78df47dab0b0f2d20}{ecore\_evas\_get}}(ee1);
   evas2 = \mbox{\hyperlink{group__Ecore__Evas__Group_ga75a7cc694b6069e78df47dab0b0f2d20}{ecore\_evas\_get}}(ee2);

   bg1 = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(evas1);
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(bg1, 255, 255, 255, 255); \textcolor{comment}{/* white bg */}
   evas\_object\_move(bg1, 0, 0);                    \textcolor{comment}{/* at canvas' origin */}
   evas\_object\_resize(bg1, WIDTH, HEIGHT);         \textcolor{comment}{/* covers full canvas */}
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(bg1);

   bg2 = \mbox{\hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}}(evas2);
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}}(bg2, 255, 255, 255, 255); \textcolor{comment}{/* white bg */}
   evas\_object\_move(bg2, 0, 0);                    \textcolor{comment}{/* at canvas' origin */}
   evas\_object\_resize(bg2, WIDTH, HEIGHT);         \textcolor{comment}{/* covers full canvas */}
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(bg2);

   edje\_obj1 = edje\_object\_add(evas1);
   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(edje\_obj1, 
      \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a9fa52651ccf7e47cd3b7785fc4cf393f}{EVAS\_CALLBACK\_MOUSE\_DOWN}},
                                  \_on\_mouse\_down, NULL);

   edje\_object\_file\_set(edje\_obj1, edje\_file\_path, \textcolor{stringliteral}{"example\_color\_class"});
   evas\_object\_move(edje\_obj1, 0, 0); \textcolor{comment}{/* at canvas' origin */}
   evas\_object\_resize(edje\_obj1, WIDTH, HEIGHT);
   \mbox{\hyperlink{group__Edje__Part__Drag_gafd2241781aedc44a0f4cdc63bb029784}{edje\_object\_part\_text\_set}}(edje\_obj1, \textcolor{stringliteral}{"part\_four"}, \textcolor{stringliteral}{"EDJE EXAMPLE"});
   edje\_object\_signal\_callback\_add(edje\_obj1, \textcolor{stringliteral}{"color\_class,del"}, \textcolor{stringliteral}{"*"},
                                   (Edje\_Signal\_Cb) \_color\_class\_callback\_delete,
                                   \textcolor{stringliteral}{"process"});
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(edje\_obj1);

   edje\_obj2 = edje\_object\_add(evas2);
   \mbox{\hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}}(edje\_obj2, 
      \mbox{\hyperlink{Evas__Common_8h_ad64cde0da38a60e7cb7905b3ab216968a9fa52651ccf7e47cd3b7785fc4cf393f}{EVAS\_CALLBACK\_MOUSE\_DOWN}},
                                  \_on\_mouse\_down, NULL);

   edje\_object\_file\_set(edje\_obj2, edje\_file\_path, \textcolor{stringliteral}{"example\_color\_class"});
   evas\_object\_move(edje\_obj2, 0, 0); \textcolor{comment}{/* at canvas' origin */}
   evas\_object\_resize(edje\_obj2, WIDTH, HEIGHT);
   \mbox{\hyperlink{group__Edje__Part__Drag_gafd2241781aedc44a0f4cdc63bb029784}{edje\_object\_part\_text\_set}}(edje\_obj2, \textcolor{stringliteral}{"part\_four"}, \textcolor{stringliteral}{"EDJE OBJECT EXAMPLE"});
   edje\_object\_signal\_callback\_add(edje\_obj2, \textcolor{stringliteral}{"color\_class,del"}, \textcolor{stringliteral}{"*"},
                                   (Edje\_Signal\_Cb) \_color\_class\_callback\_delete,
                                   \textcolor{stringliteral}{"object"});
   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(edje\_obj2);

   \textcolor{keywordflow}{return} 1;
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{int} argc, \textcolor{keywordtype}{char} *argv[])
\{
   \textcolor{keyword}{const} \textcolor{keywordtype}{char}  *edje\_file = PACKAGE\_DATA\_DIR\textcolor{stringliteral}{"/color-class.edj"};
   color        c1, c2, c3;
   \textcolor{keywordtype}{int}          i;

   \textcolor{keywordflow}{if} (argc != 5)
     \{
        fprintf(stderr, \textcolor{stringliteral}{"You have to use: %s color\_class\_name color1, color2,"} \(\backslash\)
                \textcolor{stringliteral}{"color3\(\backslash\)n"}, argv[0]);
        fprintf(stderr, \textcolor{stringliteral}{"Available colors:\(\backslash\)n"});
        \textcolor{keywordflow}{for} (i = 0; i < 8; i++)
          fprintf(stderr, \textcolor{stringliteral}{"%s\(\backslash\)n"}, color\_names[i]);

        \textcolor{keywordflow}{return} EXIT\_FAILURE;
     \}

   selected\_class = argv[1];
   \textcolor{keywordflow}{if} (!(\_get\_color\_from\_name(argv[2], &c1) &&
         \_get\_color\_from\_name(argv[3], &c2) &&
         \_get\_color\_from\_name(argv[4], &c3)))
     \{
        fprintf(stderr, \textcolor{stringliteral}{"Color not available!\(\backslash\)n"});
        \textcolor{keywordflow}{return} EXIT\_FAILURE;
     \}

   \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Ecore__Evas__Group_ga32ddbb6457033ad435a177eb0c4fe235}{ecore\_evas\_init}}())
     \textcolor{keywordflow}{return} EXIT\_FAILURE;

   \textcolor{keywordflow}{if} (!\mbox{\hyperlink{group__Edje__General__Group_ga1c9c6594f38023c29fbfb2d0c8c675db}{edje\_init}}())
     \textcolor{keywordflow}{goto} shutdown\_ecore\_evas;

   \textcolor{keywordflow}{if} (!\_create\_windows(edje\_file)) \textcolor{keywordflow}{goto} shutdown\_edje;

   \mbox{\hyperlink{group__Edje__Object__Color__Class_ga684435de625bdbb996e405e3eaaa54ad}{edje\_color\_class\_set}}(argv[1],                     \textcolor{comment}{/* class name   */}
                        c1[0], c1[1], c1[2], c1[3],  \textcolor{comment}{/* Object color */}
                        c2[0], c2[1], c2[2], c2[3],  \textcolor{comment}{/* Text outline */}
                        c3[0], c3[1], c3[2], c3[3]); \textcolor{comment}{/* Text shadow  */}

   \textcolor{comment}{/* Setting an arbitrary value just to see the difference between */}
   \textcolor{comment}{/* process level and object level */}
   edje\_object\_color\_class\_set(edje\_obj2, argv[1], \textcolor{comment}{/* class name   */}
                               128, 180, 77, 255,  \textcolor{comment}{/* Object color */}
                               200, 22, 86, 255,   \textcolor{comment}{/* Text outline */}
                               39, 90, 187, 255);  \textcolor{comment}{/* Text shadow  */}

   \_color\_classes\_print();

   \mbox{\hyperlink{group__Ecore__Evas__Group_ga4953047ff97d4f1b0d75a7d513d4f317}{ecore\_evas\_show}}(ee1);
   \mbox{\hyperlink{group__Ecore__Evas__Group_ga4953047ff97d4f1b0d75a7d513d4f317}{ecore\_evas\_show}}(ee2);

   \mbox{\hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}}();

   \mbox{\hyperlink{group__Ecore__Evas__Group_gad3ec61f2aa03df4d3dbfd0d311e0c8dc}{ecore\_evas\_free}}(ee1);
   \mbox{\hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}}();
   \mbox{\hyperlink{group__Edje__General__Group_ga01041f6702f2d81bf10c3e41899805cb}{edje\_shutdown}}();

   \textcolor{keywordflow}{return} EXIT\_SUCCESS;

 shutdown\_edje:
   \mbox{\hyperlink{group__Edje__General__Group_ga01041f6702f2d81bf10c3e41899805cb}{edje\_shutdown}}();
 shutdown\_ecore\_evas:
   \mbox{\hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}}();

   \textcolor{keywordflow}{return} EXIT\_FAILURE;
\}
\end{DoxyCodeInclude}


The theme used in this example is\+: 
\begin{DoxyCodeInclude}
color\_classes \{
    color\_class \{
       name: "red\_class";
       color: 255 0 0 255;       /* red */
       color2: 255 0 0 255;      /* red */
       color3: 255 0 0 255;      /* red */
    \}
    color\_class \{
       name: "green\_class";
       color: 0 255 0 255;       /* green */
       color2: 0 255 0 255;      /* green */
       color3: 0 255 0 255;      /* green */
    \}
    color\_class \{
       name: "blue\_class";
       color: 0 0 255 255;       /* blue */
       color2: 0 0 255 255;      /* blue */
       color3: 0 0 255 255;      /* blue */
    \}
\}

collections \{
   group \{
      name: "example\_color\_class";
      max: 500 500;
      min: 50 50;

      parts \{
         part \{
            name: "part\_one";
            type: RECT;
            scale: 1;
            description \{
               state: "default" 0.0;
               color: 255 255 255 255;
               color\_class: "blue\_class";
               rel1.relative: 0.0 0.0;
               rel2.relative: 0.5 0.5;
            \}
         \}

         part \{
            name: "part\_two";
            type: RECT;
            description \{
               state: "default" 0.0;
               color: 255 255 255 255;
               color\_class: "green\_class";
               rel1.relative: 0.5 0.0;
               rel2.relative: 1.0 0.5;
            \}
         \}
         part \{
            name: "part\_three";
            type: RECT;
            description \{
               state: "default" 0.0;
               color: 255 255 255 255;
               color\_class: "red\_class";
               rel1.relative: 0.0 0.5;
               rel2.relative: 1.0 1.0;
            \}
         \}
         part \{
            name: "part\_four";
            type: TEXT;
            effect: OUTLINE\_SHADOW;
            description \{
               state: "default" 0.0;
               min: 50 50;
               color: 255 255 255 255;
               color2: 255 255 255 255;
               color3: 255 255 255 255;
               color\_class: "blue\_class";
               rel1.relative: 0.0 0.5;
               rel2.relative: 1.0 1.0;
               text \{
                  text\_class: "example";
                  font: "arial";
                  size: 45;
                  min: 1 1;
                  ellipsis: -1;
               \}
            \}
         \}
      \}
   \}
\}
\end{DoxyCodeInclude}


To compile use this command\+: \begin{DoxyVerb}* gcc -o edje-color-class edje-color-class.c -DPACKAGE_BIN_DIR=\"/Where/enlightenment/is/installed/bin\"
* -DPACKAGE_LIB_DIR=\"/Where/enlightenment/is/installed/lib\"
* -DPACKAGE_DATA_DIR=\"/Where/enlightenment/is/installed/share\"
* `pkg-config --cflags --libs evas ecore ecore-evas edje`
*
* edje_cc color-class.edc
* \end{DoxyVerb}
 