├── .gitignore
├── colors.png
├── Makefile
├── README.md
├── LICENSE.md
└── main.c
/.gitignore:
--------------------------------------------------------------------------------
1 | modern_stickies
2 |
--------------------------------------------------------------------------------
/colors.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AlexDenisov/ModernStickies/HEAD/colors.png
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | BINARY_PATH=/Applications/Modern\ Stickies.app/Contents/MacOS/Stickies
2 |
3 | patch: build
4 | ./modern_stickies $(BINARY_PATH)
5 |
6 | build:
7 | clang main.c -o modern_stickies
8 |
9 | clean:
10 | rm -f modern_stickies
11 |
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ModernStickies
2 |
3 | Simple program that patches the Stickies.app binary to change default sticky note colors.
4 |
5 | It works on my machine, but it may not work on your machine. Or with your version of the Stickies.app.
6 |
7 | I tested it on OS X 10.12.1, with Stickies.app Version 10.0 (1000).
8 |
9 | ### Disclaimer
10 |
11 | I am not responsible for any damage this code may cause on your machine.
12 |
13 | If you decide to use it - make a backup copy.
14 |
15 | ### Usage
16 |
17 | Stickies.app is part of OS X distribution. It means that there us no way you
18 | can modify, rename, or delete the app.
19 |
20 | I recommend to make a copy of the app, call it `Modern Stickies.app`, and then
21 | simply run `make patch`.
22 |
23 | Open the Modern Stickies.app and voilà:
24 |
25 |
26 |
27 | ### License
28 |
29 | The code is distributed under MIT license. See LICENSE.md for more details.
30 |
31 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2017 Alex Denisov
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/main.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 |
6 | typedef struct {
7 | double red;
8 | double green;
9 | double blue;
10 | } color;
11 |
12 | color rgb(const unsigned char red,
13 | const unsigned char green,
14 | const unsigned char blue) {
15 | color c = { red / 255.0, green / 255.0, blue / 255.0 };
16 | return c;
17 | }
18 |
19 | typedef struct {
20 | color background_color;
21 | color border_color;
22 | color window_title_color;
23 | color icon_color;
24 | } theme;
25 |
26 | static const int ColorBase = 0x0000c240;
27 |
28 | void dump_color(const char *name, const color c) {
29 | printf("%s:\n", name);
30 | printf(" r: %f\n g: %f\n b: %f\n\n", c.red, c.green, c.blue);
31 | }
32 |
33 | void dump_theme(const int color_index, FILE *binary) {
34 | const int offset = (color_index + (color_index * 2)) << 5;
35 | const int base = ColorBase + offset;
36 | fseek(binary, base, SEEK_SET);
37 | theme t;
38 | fread(&t, sizeof(theme), 1, binary);
39 | rewind(binary);
40 |
41 | printf("%d\n", color_index);
42 | dump_color("background_color", t.background_color);
43 | dump_color("border_color", t.border_color);
44 | dump_color("window_title_color", t.window_title_color);
45 | dump_color("icon_color", t.icon_color);
46 | }
47 |
48 | void apply_theme(const int color_index, const theme t, FILE *binary) {
49 | const int offset = (color_index + (color_index * 2)) << 5;
50 | const int base = ColorBase + offset;
51 | fseek(binary, base, SEEK_SET);
52 | fwrite(&t, sizeof(theme), 1, binary);
53 | rewind(binary);
54 | }
55 |
56 | void change_color(color c, FILE *binary) {
57 | fseek(binary, ColorBase, SEEK_SET);
58 | fwrite(&c, sizeof(color), 1, binary);
59 | rewind(binary);
60 | }
61 |
62 | /// Default Themes
63 |
64 | theme default_yellow_theme() {
65 | color background_color = { 0.996078, 0.956862, 0.611764 };
66 | color border_color = { 0.737255, 0.662745, 0.007843 };
67 | color window_title_color = { 0.996078, 0.917647, 0.239216 };
68 | color icon_color = { 0.858824, 0.772549, 0.011765 };
69 |
70 | theme t = { background_color, border_color, window_title_color, icon_color };
71 | return t;
72 | }
73 |
74 | theme default_blue_theme() {
75 | color background_color = { 0.678431, 0.956863, 1 };
76 | color border_color = { 0.007843, 0.737255, 0.843137 };
77 | color window_title_color = { 0.537255, 0.941176, 1 };
78 | color icon_color = { 0.141176, 0.815686, 0.913725 };
79 |
80 | theme t = { background_color, border_color, window_title_color, icon_color };
81 | return t;
82 | }
83 |
84 | theme default_green_theme() {
85 | color background_color = { 0.698039, 1, 0.631373 };
86 | color border_color = { 0.282353, 0.635294, 0.282353 };
87 | color window_title_color = { 0.513725, 0.996078, 0.513725 };
88 | color icon_color = { 0.317647, 0.733333, 0.317647 };
89 |
90 | theme t = { background_color, border_color, window_title_color, icon_color };
91 | return t;
92 | }
93 |
94 | theme default_pink_theme() {
95 | color background_color = { 1, 0.780392, 0.780392 };
96 | color border_color = { 0.886275, 0.458824, 0.458824 };
97 | color window_title_color = { 1, 0.698039, 0.698039 };
98 | color icon_color = { 0.972549, 0.498039, 0.498039 };
99 |
100 | theme t = { background_color, border_color, window_title_color, icon_color };
101 | return t;
102 | }
103 |
104 | theme default_purple_theme() {
105 | color background_color = { 0.713725, 0.792157, 1 };
106 | color border_color = { 0.458824, 0.568627, 0.862745 };
107 | color window_title_color = { 0.607843, 0.713725, 0.996078 };
108 | color icon_color = { 0.490196, 0.607843, 0.921569 };
109 |
110 | theme t = { background_color, border_color, window_title_color, icon_color };
111 | return t;
112 | }
113 |
114 | theme default_gray_theme() {
115 | color background_color = { 0.933333, 0.933333, 0.933333 };
116 | color border_color = { 0.619608, 0.619608, 0.619608 };
117 | color window_title_color = { 0.854902, 0.854902, 0.854902 };
118 | color icon_color = { 0.658824, 0.658824, 0.658824 };
119 |
120 | theme t = { background_color, border_color, window_title_color, icon_color };
121 | return t;
122 | }
123 |
124 | void apply_default_themes(FILE *binary) {
125 | apply_theme(0, default_yellow_theme(), binary);
126 | apply_theme(1, default_blue_theme(), binary);
127 | apply_theme(2, default_green_theme(), binary);
128 | apply_theme(3, default_pink_theme(), binary);
129 | apply_theme(4, default_purple_theme(), binary);
130 | apply_theme(5, default_gray_theme(), binary);
131 | }
132 |
133 | /// Non Default Themes
134 |
135 | theme yellow_theme() {
136 | theme t;
137 |
138 | t.background_color = rgb(244, 247, 247);
139 | t.window_title_color = rgb(255, 225, 12);
140 | t.icon_color = t.window_title_color;
141 | t.border_color = t.window_title_color;
142 |
143 | return t;
144 | }
145 |
146 | theme blue_theme() {
147 | /// http://www.colourlovers.com/palette/15/tech_light
148 | theme t;
149 |
150 | t.background_color = rgb(255, 255, 255);
151 | t.window_title_color = rgb(38, 173, 228);
152 | t.icon_color = t.window_title_color;
153 | t.border_color = rgb(77, 188, 233);
154 |
155 | return t;
156 | }
157 |
158 | theme green_theme() {
159 | /// http://www.colourlovers.com/palette/15/tech_light
160 | theme t;
161 |
162 | t.background_color = rgb(255, 255, 255);
163 | t.window_title_color = rgb(174, 226, 57);
164 | t.icon_color = t.window_title_color;
165 | t.border_color = rgb(143, 190, 0);
166 |
167 | return t;
168 |
169 | }
170 |
171 | theme pink_theme() {
172 | /// http://www.colourlovers.com/palette/5079/Hibiscus
173 | theme t;
174 |
175 | t.background_color = rgb(255, 255, 255);
176 | t.window_title_color = rgb(255,84,117);
177 | t.icon_color = t.window_title_color;
178 | t.border_color = t.window_title_color;
179 |
180 | return t;
181 |
182 | }
183 |
184 | theme purple_theme() {
185 | /// http://www.colourlovers.com/palette/7315/Pop_Is_Everything
186 | theme t;
187 |
188 | t.background_color = rgb(255, 255, 255);
189 | t.window_title_color = rgb(170,0,255);
190 | t.icon_color = t.window_title_color;
191 | t.border_color = t.window_title_color;
192 |
193 | return t;
194 |
195 | }
196 |
197 | theme gray_theme() {
198 | /// http://www.colourlovers.com/palette/148712/Gamebookers
199 | theme t;
200 |
201 | t.background_color = rgb(233, 233, 233);
202 | t.window_title_color = rgb(66, 66, 66);
203 | t.icon_color = t.window_title_color;
204 | t.border_color = rgb(188, 188, 188);
205 |
206 | return t;
207 | }
208 |
209 | void apply_themes(FILE *binary) {
210 | apply_theme(0, yellow_theme(), binary);
211 | apply_theme(1, blue_theme(), binary);
212 | apply_theme(2, green_theme(), binary);
213 | apply_theme(3, pink_theme(), binary);
214 | apply_theme(4, purple_theme(), binary);
215 | apply_theme(5, gray_theme(), binary);
216 | }
217 |
218 | color red_color() {
219 | color c = { 1, 0, 0 };
220 | return c;
221 | }
222 |
223 | theme debug_theme() {
224 | theme t = default_yellow_theme();
225 |
226 | /* t.background_color = red_color(); */
227 | /* t.window_title_color = red_color(); */
228 | /* t.icon_color = red_color(); */
229 | /* t.border_color = red_color(); */
230 |
231 | return t;
232 | }
233 |
234 | int main(int argc, char **argv) {
235 | const char *binary_path = argv[1];
236 | FILE *binary = fopen(binary_path, "r+b");
237 | if (!binary) {
238 | printf("Can't open %s\n", binary_path);
239 | return 1;
240 | }
241 |
242 | apply_themes(binary);
243 | /* apply_theme(0, debug_theme(), binary); */
244 |
245 | fclose(binary);
246 |
247 | return 0;
248 | }
249 |
250 |
--------------------------------------------------------------------------------