Skip to content

add color to botany#44

Open
joyalicegu wants to merge 1 commit intojifunks:masterfrom
joyalicegu:master
Open

add color to botany#44
joyalicegu wants to merge 1 commit intojifunks:masterfrom
joyalicegu:master

Conversation

@joyalicegu
Copy link

@joyalicegu joyalicegu commented Dec 26, 2021

Add ansi_render() to menu_screen.py to render ANSI-colored ASCII art.

Fall back on non-colored art if no colored art exists.

Only some escape codes for setting foreground color are supported.
Unsupported escape codes reset colors to normal.

Add ANSI-colored ASCII art for all plants to "art" directory.
Most of the art was colored using durdraw.
Add art/test.ansi for debugging purposes.

Also add a debugging mode for previewing art that can be enabled by
setting the "debug_art" flag to True in menu_screen.py. It adds a
"DEBUG" menu option that cycles through all art files.

(edited with updated commit message above)


Screenshots:

screenshot-botany-dark
screenshot-botany-light
screenshot-botany-jackolantern
screenshot-botany-rip
screenshot-botany-seed
screenshot-botany-seedling

Demo videos of debug mode:

light.mp4
dark.mp4

@vilmibm
Copy link
Collaborator

vilmibm commented Apr 4, 2024

I love this PR and hope to merge it; I'd like to test it out some.

@joyalicegu
Copy link
Author

This is really old, and I didn't finish coloring all of the existing ascii art. I will probably do some more work on it over the next couple of weeks (I should have an update to this PR ready by May).

I would like to test it more, too. I want to make sure it doesn't behave unexpectedly in different terminals / screen sizes / etc. Since this is just using the curses library, I don't expect anything weird to happen, but you never know. Maybe some other townies can try it out?

@joyalicegu
Copy link
Author

Sorry, it's been a while. I plan to continue this. Currently working on coloring the remaining art with durdraw.

@joyalicegu
Copy link
Author

I've added all the remaining colored art for the plants. There's also a debug mode that allows cycling through art in botany for debugging purposes (set "self.debug_art = True" in menu_screen.py). I'll try to attach a demo video of the art in dark mode and light mode.

I did notice that plants have a "color" descriptor (in plant.py), and the color might not match that of the art displayed. Is that going to be a problem?

I think it would also be nice for people to be able to toggle this on and off (not sure where the setting would be saved though). Currently, the program just uses curses.has_colors().

Add ansi_render() to menu_screen.py to render ANSI-colored ASCII art.

Fall back on non-colored art if no colored art exists.

Only some escape codes for setting foreground color are supported.
Unsupported escape codes reset colors to normal.

Add ANSI-colored ASCII art for all plants to "art" directory.
Most of the art was colored using durdraw.
Add art/test.ansi for debugging purposes.

Also add a debugging mode for previewing art that can be enabled by
setting the "debug_art" flag to True in menu_screen.py. It adds a
"DEBUG" menu option that cycles through all art files.
@joyalicegu
Copy link
Author

Added demo videos of debug mode to the top comment, with all the colored art.

@joyalicegu
Copy link
Author

I did notice that plants have a "color" descriptor (in plant.py), and the color might not match that of the art displayed. Is that going to be a problem?

Not sure what to do about this, thinking maybe I could have some designated color just be replaced by whatever color is in the color descriptor. e.g. green. Or the "color" could just sort of be a non-literal descriptor, and we could just ignore this. Or we could have a map for each plant where it shows where the color should be overridden by this color descriptor.

What do people think?

I think it would also be nice for people to be able to toggle this on and off (not sure where the setting would be saved though). Currently, the program just uses curses.has_colors().

I guess this could be saved in the plant.json? And there could be an extra preferences menu, where this could be toggled. I don't want to make botany more complicated than it has to be though; a big part of its charm is its simplicity.

Does anyone have suggestions?

cc: @jifunks @vilmibm @noelleleigh

@noelleleigh
Copy link
Contributor

I think it would also be nice for people to be able to toggle this on and off (not sure where the setting would be saved though). Currently, the program just uses curses.has_colors().

I guess this could be saved in the plant.json? And there could be an extra preferences menu, where this could be toggled. I don't want to make botany more complicated than it has to be though; a big part of its charm is its simplicity.

A good start for allowing the user to control color output would be to respect NO_COLOR and FORCE_COLOR as described in the Python documentation.

@joyalicegu
Copy link
Author

joyalicegu commented Jan 31, 2026 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants