viking-sudo-rm / rtflib

Python library for writing RTF files.
MIT License
8 stars 4 forks source link

Adding background cell color #10

Closed Neon22 closed 1 month ago

Neon22 commented 1 month ago

modified rtf.py to allow for add_color which returns index of the rgb for use on a row background

modified table to allow addition of bgtable color pattern.

also cleaned up my additions a little

viking-sudo-rm commented 1 month ago

I like what you did with rtf.add_color! However, it's a bit different from how Line color works currently. It could be confusing for other users that the two color arguments work differently.

Before I merge, could you update how colors work with lines to use the same interface? That way, it will be easier for new users to understand how colors work.

I think the cleanest design is for both to take a Color object that is registered and returned by rtf.add_color. Concretely, I suggest the following design:

class Color(NamedTuple):
  red: int
  green: int
  blue: int
  cid: int

Let me know if anything is unclear or you have questions/other ideas.

Neon22 commented 1 month ago

Thanks, will get to it soon.

Neon22 commented 1 month ago

new PR raised

Neon22 commented 1 month ago

closing as superseded