Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The B, N,F colors in a CPT #8294

Closed
PaulWessel opened this issue Jan 15, 2024 · 2 comments
Closed

The B, N,F colors in a CPT #8294

PaulWessel opened this issue Jan 15, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@PaulWessel
Copy link
Member

Per the documentation, gmt makecpt will write out the B, N, F colors in the CPT have them. You can add -M to instead use the GMT Defaults settings COLOR_BACKGROUND, COLOR_NAN and COLOR_FOREGROUND. But, looks like we have an issue here. Here is the tail of share/cpt/SCM/roma.cpt:

...
0.984314        7/53/154        0.992156        5/51/153
0.992156        5/51/153        1.000000        3/49/152
N       255/255/255
B       126/23/0
F       3/49/152

If I ask for roma when building a CPT, I get

gmt makecpt -Croma -T2150/3050  | tail -5
3042.9413	7/53/154	3046.4702	5/51/153	L
3046.4702	5/51/153	3050	3/49/152	B
B	126/23/0
F	3/49/152
N	white

So that matches. Now, if you add -M we are supposed to get these defaults instead:

COLOR_BACKGROUND	= black
COLOR_FOREGROUND	= white
COLOR_NAN	 = 128

Try again:

gmt makecpt -Croma -T2150/3050  -M | tail -5
3042.9413	7/53/154	3046.4702	5/51/153	L
3046.4702	5/51/153	3050	3/49/152	B
B	black
F	white
N	128

OK, that is fine. How about this?

gmt makecpt -Croma -T2150/3050 -I --COLOR_BACKGROUND=black --COLOR_FOREGROUND=white --COLOR_NAN=128 -M | tail -5  
3042.9413	128/29/2	3046.4702	127/26/1	L
3046.4702	127/26/1	3050	126/23/0	B
B	white
F	black
N	128

Opps, despite setting the same values as the defaults, suddenly B and F are flipped. Seems like we have a bug in the parsing of those two settings?

Can any confirm we have an issue here?

@PaulWessel PaulWessel added the bug Something isn't working label Jan 15, 2024
@yvonnefroehlich
Copy link
Member

gmt makecpt -Croma -T2150/3050 -I --COLOR_BACKGROUND=black --COLOR_FOREGROUND=white --COLOR_NAN=128 -M | tail -5  
3042.9413	128/29/2	3046.4702	127/26/1	L
3046.4702	127/26/1	3050	126/23/0	B
B	white
F	black
N	128

Opps, despite setting the same values as the defaults, suddenly B and F are flipped. Seems like we have a bug in the parsing of those two settings?

Can any confirm we have an issue here?

Hm. From the makecpt documentation, I understand that this flipping of background (B) and foreground (F) colors is expected when -I is used.

@PaulWessel
Copy link
Member Author

Thanks @yvonnefroehlich you are absolutely right! I am losing it, obviously. Closing this silly issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants