#include "define.h"
#include "data/app.h"
-/* It is temporarily used. */
-#define COUNT_COLOR 7
-
-struct color {
- int r;
- int g;
- int b;
- int a;
-};
-
-static struct color color_icon[] = {
- {73, 155, 173, 255},
- {104, 99, 93, 255},
- {92, 122, 190, 255},
- {219, 162, 96, 255},
- {97, 109, 124, 255},
- {79, 187, 165, 255},
- {169, 54, 54, 255},
- {255, 255, 255, 255}
-};
-
-static struct color color_text[] = {
- {55, 143, 162, 255},
- {93, 88, 82, 255},
- {75, 102, 163, 255},
- {194, 133, 62, 255},
- {86, 98, 113, 255},
- {47, 175, 149, 255},
- {155, 46, 46, 255},
- {255, 255, 255, 255}
-};
-
-
struct app_data {
char *appid;
char *name;
char *icon;
bool is_locked;
bool is_favorite;
- struct color icon_bg;
- struct color text_bg;
+ struct color_data icon_bg;
+ struct color_data text_bg;
};
-static int _get_color_index(const char *str)
+static inline void _set_default_color(struct color_data *c)
{
- int i, value = 0;
-
- if (!str)
- return 0;
-
- for (i = 0; i < strlen(str); i++)
- value += *str;
-
- return value % COUNT_COLOR;
+ c->r = 255;
+ c->g = 255;
+ c->b = 255;
+ c->a = 255;
}
static int _get_app_data_foreach(pkgmgrinfo_appinfo_h handle, void *data)
struct app_data *adata;
char *appid, *name, *icon;
bool is_favorite, nodisplay;
- int r, idx;
+ int r;
if (!data)
return -1;
adata->is_favorite = is_favorite;
- /* FIXME: The color will be changed to 'algorithm color' */
- if (!strcmp(appid, STR_BROWSER_ID))
- idx = COUNT_COLOR;
- else
- idx = _get_color_index(name);
-
- adata->icon_bg = color_icon[idx];
- adata->text_bg = color_text[idx];
+ if (!strcmp(appid, STR_BROWSER_ID)) {
+ _set_default_color(&adata->icon_bg);
+ _set_default_color(&adata->text_bg);
+ } else {
+ app_contents_get_color(name, &adata->icon_bg, &adata->text_bg);
+ }
*list = eina_list_append(*list, adata);