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

tabColor: support options other than RGB #1283

Closed
thomascharbonnel opened this issue Jul 21, 2022 · 5 comments
Closed

tabColor: support options other than RGB #1283

thomascharbonnel opened this issue Jul 21, 2022 · 5 comments
Labels
enhancement New feature or request
Projects

Comments

@thomascharbonnel
Copy link
Contributor

Description

Related to #785. I've noticed the tab color feature only supports RGB (read and write) currently. Do you think it would be okay to add support for the other types of tab colors (eg. "theme", "indexed")? I should be able to pick up this task (and the other one we discussed earlier) in the coming few weeks.

@xuri
Copy link
Member

xuri commented Jul 21, 2022

Thanks for your issue. Contributions are welcome. I think we need to make following works for this feature:

  • Add new options TabColorIndexed, TabColorTheme, TabColorTint for the SheetPrOption
  • Implement setter and getter for these options
  • Add unit test for this feature

@xuri xuri added the enhancement New feature or request label Jul 21, 2022
thomascharbonnel pushed a commit to thomascharbonnel/excelize that referenced this issue Jul 22, 2022
This commit renames `TabColor` into `TabColorRGB` (but keeps an alias
for backwards compatibility), as well as adds support for tab color
  theme.

Signed-off-by: Thomas Charbonnel <github@charbonnel.email>
@thomascharbonnel
Copy link
Contributor Author

Thanks for the help!
I've written some code to support TabColorTheme first, does this change make sense? thomascharbonnel@2e9ea92
I'm not sure what to do when theme is unset, as Golang's default int value of 0 is a valid theme value. I've chosen -1 to indicate that theme is unset. What do you think?

@xuri
Copy link
Member

xuri commented Jul 22, 2022

Okay, I agree with you.

@thomascharbonnel
Copy link
Contributor Author

Thank you for the feedback, i'll keep working on this next week.
I think i'll make the theme an enum (list of possible values: https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.drawing.colorscheme?view=openxml-2.8.1), this way -1 will be a little bit cleaner rather than a magic number.
One strange thing is that Excel does not seem to follow the spec: https://stackoverflow.com/a/2761369

@xuri
Copy link
Member

xuri commented Jul 24, 2022

Okay, make the TabColorTheme accept theme enumeration, and returns the theme index as is. In Excel the first four theme color index was different with spec. We need to make a patch for it when getting the theme-based color. For example: get the cell background color.

thomascharbonnel pushed a commit to thomascharbonnel/excelize that referenced this issue Jul 25, 2022
This commit renames `TabColor` into `TabColorRGB` (but keeps an alias
for backwards compatibility), as well as adds support for more tab color
  options (Theme, Indexed and Tint).

Signed-off-by: Thomas Charbonnel <github@charbonnel.email>
thomascharbonnel pushed a commit to thomascharbonnel/excelize that referenced this issue Jul 26, 2022
This commit renames `TabColor` into `TabColorRGB` (but keeps an alias
for backwards compatibility), as well as adds support for more tab color
  options (Theme, Indexed and Tint).

Signed-off-by: Thomas Charbonnel <github@charbonnel.email>
thomascharbonnel pushed a commit to thomascharbonnel/excelize that referenced this issue Jul 26, 2022
This commit renames `TabColor` into `TabColorRGB` (but keeps an alias
for backwards compatibility), as well as adds support for more tab color
  options (Theme, Indexed and Tint).

Signed-off-by: Thomas Charbonnel <github@charbonnel.email>
thomascharbonnel pushed a commit to thomascharbonnel/excelize that referenced this issue Jul 26, 2022
This commit renames `TabColor` into `TabColorRGB` (but keeps an alias
for backwards compatibility), as well as adds support for more tab color
  options (Theme, Indexed and Tint).

Signed-off-by: Thomas Charbonnel <github@charbonnel.email>
thomascharbonnel pushed a commit to thomascharbonnel/excelize that referenced this issue Jul 26, 2022
This commit renames `TabColor` into `TabColorRGB` (but keeps an alias
for backwards compatibility), as well as adds support for more tab color
  options (Theme, Indexed and Tint).

Signed-off-by: Thomas Charbonnel <github@charbonnel.email>
thomascharbonnel pushed a commit to thomascharbonnel/excelize that referenced this issue Jul 26, 2022
This commit renames `TabColor` into `TabColorRGB` (but keeps an alias
for backwards compatibility), as well as adds support for more tab color
  options (Theme, Indexed and Tint).

Signed-off-by: Thomas Charbonnel <github@charbonnel.email>
@xuri xuri closed this as completed in fd0eb2b Jul 26, 2022
@xuri xuri added this to Feature in v2.6.1 Jul 26, 2022
xuri pushed a commit to carbin-gun/excelize that referenced this issue Oct 9, 2022
…int for sheet tab

This commit renames `TabColor` into `TabColorRGB` (but keeps an alias for backwards compatibility), as well as adds support for more tab color options (Theme, Indexed and Tint).

Signed-off-by: Thomas Charbonnel <github@charbonnel.email>
xuri pushed a commit to JDavidVR/excelize that referenced this issue Jul 11, 2023
…int for sheet tab

This commit renames `TabColor` into `TabColorRGB` (but keeps an alias for backwards compatibility), as well as adds support for more tab color options (Theme, Indexed and Tint).

Signed-off-by: Thomas Charbonnel <github@charbonnel.email>
jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
…int for sheet tab

This commit renames `TabColor` into `TabColorRGB` (but keeps an alias for backwards compatibility), as well as adds support for more tab color options (Theme, Indexed and Tint).

Signed-off-by: Thomas Charbonnel <github@charbonnel.email>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
v2.6.1
Feature
Development

No branches or pull requests

2 participants