[GH-ISSUE #424] Implement the $book->set_custom_color() function from the Perl library in the C library #332

Closed
opened 2026-05-05 12:10:05 -06:00 by gitea-mirror · 2 comments
Owner

Originally created by @GavinMGlynn on GitHub (Dec 19, 2023).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/424

Originally assigned to: @jmcnamara on GitHub.

Feature Request

Hi

I work for a company that has made extensive use of the original Perl library. They actually wrote their own C wrapper around the Perl library to give them XLSX generation capabilities in C. Now, I am thinking to "cut out the middle man" and just use your C library directly. The only wrinkle is quite a bit of our existing code relied upon the $book->set_custom_color() functionality.

In pretty much every case, a spreadsheet is being generated for a customer, which they will eventually forward back to my company. The set $book->set_custom_color() functionality is used to set the customers color palette in the spreadsheet and then is referred to it in each format.

Thanks

Gavin Glynn :)

PS: I am happy to help make the change, if needed.

Originally created by @GavinMGlynn on GitHub (Dec 19, 2023). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/424 Originally assigned to: @jmcnamara on GitHub. ### Feature Request Hi I work for a company that has made extensive use of the original Perl library. They actually wrote their own C wrapper around the Perl library to give them XLSX generation capabilities in C. Now, I am thinking to "cut out the middle man" and just use your C library directly. The only wrinkle is quite a bit of our existing code relied upon the `$book->set_custom_color()` functionality. In pretty much every case, a spreadsheet is being generated for a customer, which they will eventually forward back to my company. The set `$book->set_custom_color()` functionality is used to set the customers color palette in the spreadsheet and then is referred to it in each format. Thanks Gavin Glynn :) PS: I am happy to help make the change, if needed.
gitea-mirror 2026-05-05 12:10:05 -06:00
Author
Owner

@jmcnamara commented on GitHub (Dec 20, 2023):

I'll have a look at it soon.

<!-- gh-comment-id:1864073461 --> @jmcnamara commented on GitHub (Dec 20, 2023): I'll have a look at it soon.
Author
Owner

@jmcnamara commented on GitHub (Apr 4, 2024):

I finally got around to looking at this feature request and unfortunately it isn't feasible in the C version of the library.

A long time time ago, I implemented the set_custom_color() method in Excel::Writer::XLSX version to account for similar functionality in the my older XLS writing Spreadsheet::WriteExcel library. It was necessary in the older version because Excel had a limited color palette of ~ 64 colors and that was the only way to change them.

However in the XLSX format Excel supported 16 million RGB colors so that form of custom color functionality was no longer required. As a result I didn't port it to any of the subsequent Python, C or Rust libraries. And at this point in time it doesn't make sense to retrofit it. Sorry about that.

As a workaround you could possibly use named variables for each color you need and modify the RGB value based on the customer.

Closing as won't fix

<!-- gh-comment-id:2036823186 --> @jmcnamara commented on GitHub (Apr 4, 2024): I finally got around to looking at this feature request and unfortunately it isn't feasible in the C version of the library. A long time time ago, I implemented the `set_custom_color()` method in Excel::Writer::XLSX version to account for similar functionality in the my older XLS writing Spreadsheet::WriteExcel library. It was necessary in the older version because Excel had a limited color palette of ~ 64 colors and that was the only way to change them. However in the XLSX format Excel supported 16 million RGB colors so that form of custom color functionality was no longer required. As a result I didn't port it to any of the subsequent Python, C or Rust libraries. And at this point in time it doesn't make sense to retrofit it. Sorry about that. As a workaround you could possibly use named variables for each color you need and modify the RGB value based on the customer. Closing as won't fix
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/libxlsxwriter#332
No description provided.