ttheme.c - ledit - Text editor (WIP) | |
git clone git://lumidify.org/ledit.git (fast, but not encrypted) | |
git clone https://lumidify.org/git/ledit.git (encrypted, but very slow) | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
ttheme.c (2666B) | |
--- | |
1 #include <stddef.h> | |
2 | |
3 #include <X11/Xlib.h> | |
4 #include <X11/Xft/Xft.h> | |
5 | |
6 #include "memory.h" | |
7 #include "common.h" | |
8 #include "theme.h" | |
9 #include "theme_config.h" | |
10 | |
11 ledit_theme * | |
12 theme_create(ledit_common *common) { | |
13 ledit_theme *theme = ledit_malloc(sizeof(ledit_theme)); | |
14 theme->scrollbar_width = SCROLLBAR_WIDTH; | |
15 theme->scrollbar_step = SCROLLBAR_STEP; | |
16 theme->text_font = TEXT_FONT; | |
17 theme->text_size = TEXT_SIZE; | |
18 theme->text_fg_hex = TEXT_FG; | |
19 theme->text_bg_hex = TEXT_BG; | |
20 theme->cursor_fg_hex = CURSOR_FG; | |
21 theme->cursor_bg_hex = CURSOR_BG; | |
22 theme->selection_fg_hex = SELECTION_FG; | |
23 theme->selection_bg_hex = SELECTION_BG; | |
24 theme->bar_fg_hex = BAR_FG; | |
25 theme->bar_bg_hex = BAR_BG; | |
26 theme->bar_cursor_hex = BAR_CURSOR; | |
27 theme->scrollbar_fg_hex = SCROLLBAR_FG; | |
28 theme->scrollbar_bg_hex = SCROLLBAR_BG; | |
29 XftColorAllocName(common->dpy, common->vis, common->cm, TEXT_FG,… | |
30 XftColorAllocName(common->dpy, common->vis, common->cm, TEXT_BG,… | |
31 XftColorAllocName(common->dpy, common->vis, common->cm, CURSOR_F… | |
32 XftColorAllocName(common->dpy, common->vis, common->cm, CURSOR_B… | |
33 XftColorAllocName(common->dpy, common->vis, common->cm, SELECTIO… | |
34 XftColorAllocName(common->dpy, common->vis, common->cm, SELECTIO… | |
35 XftColorAllocName(common->dpy, common->vis, common->cm, BAR_FG, … | |
36 XftColorAllocName(common->dpy, common->vis, common->cm, BAR_BG, … | |
37 XftColorAllocName(common->dpy, common->vis, common->cm, BAR_CURS… | |
38 XftColorAllocName(common->dpy, common->vis, common->cm, SCROLLBA… | |
39 XftColorAllocName(common->dpy, common->vis, common->cm, SCROLLBA… | |
40 return theme; | |
41 } | |
42 | |
43 void | |
44 theme_destroy(ledit_common *common, ledit_theme *theme) { | |
45 XftColorFree(common->dpy, common->vis, common->cm, &theme->text_… | |
46 XftColorFree(common->dpy, common->vis, common->cm, &theme->text_… | |
47 XftColorFree(common->dpy, common->vis, common->cm, &theme->curso… | |
48 XftColorFree(common->dpy, common->vis, common->cm, &theme->curso… | |
49 XftColorFree(common->dpy, common->vis, common->cm, &theme->selec… | |
50 XftColorFree(common->dpy, common->vis, common->cm, &theme->selec… | |
51 XftColorFree(common->dpy, common->vis, common->cm, &theme->bar_f… | |
52 XftColorFree(common->dpy, common->vis, common->cm, &theme->bar_b… | |
53 XftColorFree(common->dpy, common->vis, common->cm, &theme->bar_c… | |
54 XftColorFree(common->dpy, common->vis, common->cm, &theme->scrol… | |
55 XftColorFree(common->dpy, common->vis, common->cm, &theme->scrol… | |
56 free(theme); | |
57 } |