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

Add background colors to ASCII art #42543

Closed
Ununsept117 opened this issue Jul 29, 2020 · 8 comments
Closed

Add background colors to ASCII art #42543

Ununsept117 opened this issue Jul 29, 2020 · 8 comments
Labels
Info / User Interface Game - player communication, menus, etc. stale Closed for lack of activity, but still valid. <Suggestion / Discussion> Talk it out before implementing

Comments

@Ununsept117
Copy link
Contributor

Ununsept117 commented Jul 29, 2020

Is your feature request related to a problem? Please describe.

Currently you can add background colors to ASCII art, but they will behave badly:

  1. Color tags with background colors count towards character limit in single line, producing errors about line length.
  2. Color tags with background colors don't apply to next lines, so you have to add them every new line. Such behavior is inconvenient and inconsistent - color tags without background colors apply to next lines.
  3. Many foreground and background color combinations can't be used - I think the problem is that they aren't defined in src/color.cpp.

Describe the solution you'd like

Make color tags with background colors not count towards character limit in a single line, make them apply to next lines, and add more foreground and background combinations.

Describe alternatives you've considered

Leave it as it is.

Additional context

This idea was suggested during my discussion with Kyzrati, the developer of REXPaint, an ASCII art tool. Soon he'll release a new version of REXPaint, which will include support for exporting art in a format readable by CDDA. This will include foreground and background colors, but for the background colors to work, they have to be implemented in the game first.

@ZhilkinSerg
Copy link
Contributor

ZhilkinSerg commented Jul 29, 2020

Point 2 works fine for me:

image

[
  {
    "type": "ascii_art",
    "id": "glass_bottle",
    "picture": [
      "",
      "",
      "",
      "<color_white_red>              ║   ║",
      "              ║   ║",
      "              ║   ║",
      "            ╔═╝   ╚═╗",
      "           ╔╝      #╚╗",
      "          ╔╝     ### ╚╗",
      "          ║    ####   ║",
      "          ║   ####    ║",
      "          ║  ####     ║",
      "          ║######     ║",
      "          ║####       ║",
      "          ║###        ║",
      "          ║#          ║",
      "          ║           ║",
      "          ║           ║",
      "          ║           ║",
      "          ║           ║",
      "0123456789012345678901234567890123456789A"
    ]
  }
]

@ZhilkinSerg
Copy link
Contributor

ZhilkinSerg commented Jul 29, 2020

Regarding point 1 - it is not unique to color tags with background color. Image is displayed fine in the end, despite error messages, but check code actually needs to be updated to check line with stripped color tags. It looks like issue only affects strings without properly closed <color_x> tags - possible a bug in remove_color_tags function.

image

[
  {
    "type": "ascii_art",
    "id": "glass_bottle",
    "picture": [
      "",
      "",
      "",
      "<color_white_red>              ║   ║",
      "              ║   ║",
      "              ║   ║",
      "            ╔═╝   ╚═╗",
      "           ╔╝      #╚╗",
      "          ╔╝     ### ╚╗",
      "          ║    ####   ║",
      "          ║   ####    ║",
      "          ║  ####     ║",
      "          ║######     ║",
      "          ║####       ║",
      "          ║###        ║",
      "          ║#          ║",
      "          ║           ║",
      "          ║           ║",
      "          ║           ║",
      "          ║           ║",
      "<color_green>0123456789012345678901234567890123456789A",
      "<color_red_white>0123456789012345678901234567890123456789A"
    ]
  }
]

@Ununsept117
Copy link
Contributor Author

The picture above looks fine, but when I did this

  {
    "type": "ascii_art",
    "id": "cashcard",
    "picture": [
      "",
      "",
      "",
      "       <color_white_red>╔═══════════════════╗",
      "       ║                   ║</color>",
      "       <color_white>║</color> <color_yellow>╔═   ╔═╔═╗╔═║ ║</color>   <color_white>║",
      "       <color_white>║</color> <color_yellow>║═ ┼ ║ ║═║╚╗║═║</color>   <color_white>║",
      "       <color_white>║</color> <color_yellow>╚═   ╚═║ ║═╝║ ║</color>   <color_white>║",
      "       <color_white>║                   ║",
      "       <color_white>║   RIVTECH TRUST   ║",
      "       <color_white>║                   ║",
      "       <color_white>║                   ║",
      "       <color_white>║ 555 993 55221 066 ║",
      "       <color_white>╚═══════════════════╝"
    ]
  },

it looked like that:
colorbug

@ZhilkinSerg
Copy link
Contributor

That is very strange. Here is what I see with same json:

image

Which game version and OS are you on?

@Ununsept117
Copy link
Contributor Author

Ununsept117 commented Jul 29, 2020

  • OS: Windows
    • OS Version: 10.0 1903
  • Game Version: 0.E-4529-gb82b0cb [64-bit]
  • Graphics Version: Tiles
  • Game Language: English [en]
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food]
    ]

@ZhilkinSerg
Copy link
Contributor

Point 3 is related to curses and terminals. It looks like there are different limits for color pairs on different terminals (https://linux.die.net/man/3/init_pair).

We can probably add more color pairs to the code, but they won't guaranteed to work on all terminals.

@KorGgenT KorGgenT added <Suggestion / Discussion> Talk it out before implementing Info / User Interface Game - player communication, menus, etc. labels Aug 11, 2020
@ZhilkinSerg ZhilkinSerg added Info / User Interface Game - player communication, menus, etc. and removed Info / User Interface Game - player communication, menus, etc. labels Aug 19, 2020
@stale
Copy link

stale bot commented Sep 18, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not 'bump' or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

@stale stale bot added the stale Closed for lack of activity, but still valid. label Sep 18, 2020
@stale
Copy link

stale bot commented Oct 18, 2020

This issue has been automatically closed due to lack of activity. This does not mean that we do not value the issue. Feel free to request that it be re-opened if you are going to actively work on it

@stale stale bot closed this as completed Oct 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Info / User Interface Game - player communication, menus, etc. stale Closed for lack of activity, but still valid. <Suggestion / Discussion> Talk it out before implementing
Projects
None yet
Development

No branches or pull requests

3 participants