Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
ac2dff28
Commit
ac2dff28
authored
7 years ago
by
Hisham Muhammad
Browse files
Options
Download
Email Patches
Plain Diff
Fix color behavior on some terminals.
Fixes #635.
parent
c50440f1
master
next
perfcounters
pkgconfig-on-linux
solaris
3.0.0beta5
3.0.0beta4
3.0.0beta3
3.0.0beta2
2.2.0
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CRT.c
+17
-15
CRT.c
CRT.h
+1
-0
CRT.h
ColorsPanel.c
+1
-0
ColorsPanel.c
with
19 additions
and
15 deletions
+19
-15
CRT.c
View file @
ac2dff28
...
...
@@ -37,6 +37,7 @@ in the source distribution for its full text.
#define White COLOR_WHITE
#define ColorPairGrayBlack ColorPair(Magenta,Magenta)
#define ColorIndexGrayBlack ColorIndex(Magenta,Magenta)
#define KEY_WHEELUP KEY_F(20)
#define KEY_WHEELDOWN KEY_F(21)
...
...
@@ -713,22 +714,23 @@ void CRT_enableDelay() {
void
CRT_setColors
(
int
colorScheme
)
{
CRT_colorScheme
=
colorScheme
;
if
(
colorScheme
==
COLORSCHEME_BLACKNIGHT
)
{
for
(
int
i
=
0
;
i
<
8
;
i
++
)
for
(
int
j
=
0
;
j
<
8
;
j
++
)
{
if
(
ColorIndex
(
i
,
j
)
!=
ColorIndex
(
Magenta
,
Magenta
))
{
init_pair
(
ColorIndex
(
i
,
j
),
i
,
j
);
}
}
init_pair
(
ColorIndex
(
Magenta
,
Magenta
),
8
,
0
);
}
else
{
for
(
int
i
=
0
;
i
<
8
;
i
++
)
for
(
int
j
=
0
;
j
<
8
;
j
++
)
{
if
(
ColorIndex
(
i
,
j
)
!=
ColorIndex
(
Magenta
,
Magenta
))
{
init_pair
(
ColorIndex
(
i
,
j
),
i
,
(
j
==
0
?-
1
:
j
));
}
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
for
(
int
j
=
0
;
j
<
8
;
j
++
)
{
if
(
ColorIndex
(
i
,
j
)
!=
ColorPairGrayBlack
)
{
int
bg
=
(
colorScheme
!=
COLORSCHEME_BLACKNIGHT
)
?
(
j
==
0
?
-
1
:
j
)
:
j
;
init_pair
(
ColorIndex
(
i
,
j
),
i
,
bg
);
}
init_pair
(
ColorIndex
(
Magenta
,
Magenta
),
8
,
-
1
);
}
}
int
grayBlackFg
=
COLORS
>
8
?
8
:
0
;
int
grayBlackBg
=
(
colorScheme
!=
COLORSCHEME_BLACKNIGHT
)
?
-
1
:
0
;
init_pair
(
ColorIndexGrayBlack
,
grayBlackFg
,
grayBlackBg
);
CRT_colors
=
CRT_colorSchemes
[
colorScheme
];
}
This diff is collapsed.
Click to expand it.
CRT.h
View file @
ac2dff28
...
...
@@ -26,6 +26,7 @@ in the source distribution for its full text.
#define White COLOR_WHITE
#define ColorPairGrayBlack ColorPair(Magenta,Magenta)
#define ColorIndexGrayBlack ColorIndex(Magenta,Magenta)
#define KEY_WHEELUP KEY_F(20)
#define KEY_WHEELDOWN KEY_F(21)
...
...
This diff is collapsed.
Click to expand it.
ColorsPanel.c
View file @
ac2dff28
...
...
@@ -78,6 +78,7 @@ static HandlerResult ColorsPanel_eventHandler(Panel* super, int ch) {
this
->
settings
->
changed
=
true
;
const
Header
*
header
=
this
->
scr
->
header
;
CRT_setColors
(
mark
);
clear
();
Panel
*
menu
=
(
Panel
*
)
Vector_get
(
this
->
scr
->
panels
,
0
);
Header_draw
(
header
);
RichString_setAttr
(
&
(
super
->
header
),
CRT_colors
[
PANEL_HEADER_FOCUS
]);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help