Skip to content

Commit 493873d

Browse files
committed
Bias colors towards grey
1 parent 1f23f7e commit 493873d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

conf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
* Higher is more work for the CPU, lower is less accurate.
55
*/
66
#define SPINLOCK_NS 1E6
7+
8+
#define GREY_DIFF 15

ttydisp.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ class Stream {
7171
r = r >= pad ? r - pad : 0;
7272
g = g >= pad ? g - pad : 0;
7373
b = b >= pad ? b - pad : 0;
74+
if(abs(r - g) <= GREY_DIFF && abs(r - b) <= GREY_DIFF && abs(b - g) <= GREY_DIFF) {
75+
int t = r + g + b;
76+
r = t/3;
77+
g = r;
78+
b = r;
79+
}
7480
return 16 + (36 * lround(r*5.0/255)) + (6 * lround(g*5.0/255)) + lround(b*5.0/255);
7581
}
7682
void resetFrame(unsigned height) {

0 commit comments

Comments
 (0)