XlsxWriter 3.2.3__tar.gz → 3.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/Changes +24 -0
  2. {xlsxwriter-3.2.3/XlsxWriter.egg-info → xlsxwriter-3.2.4}/PKG-INFO +3 -3
  3. xlsxwriter-3.2.4/examples/colors.py +87 -0
  4. xlsxwriter-3.2.4/setup.py +35 -0
  5. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/__init__.py +1 -1
  6. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/chart.py +88 -30
  7. xlsxwriter-3.2.4/xlsxwriter/color.py +431 -0
  8. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/comments.py +6 -13
  9. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/drawing.py +10 -15
  10. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/format.py +41 -43
  11. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/image.py +5 -3
  12. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/shape.py +20 -2
  13. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/styles.py +16 -31
  14. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/url.py +19 -18
  15. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/utility.py +383 -375
  16. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/vml.py +1 -1
  17. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/workbook.py +7 -19
  18. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/worksheet.py +70 -77
  19. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4/xlsxwriter.egg-info}/PKG-INFO +3 -3
  20. {xlsxwriter-3.2.3/XlsxWriter.egg-info → xlsxwriter-3.2.4/xlsxwriter.egg-info}/SOURCES.txt +7 -5
  21. xlsxwriter-3.2.3/setup.py +0 -55
  22. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/LICENSE.txt +0 -0
  23. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/MANIFEST.in +0 -0
  24. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/README.rst +0 -0
  25. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/array_formula.py +0 -0
  26. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/autofilter.py +0 -0
  27. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/autofilter_data.txt +0 -0
  28. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/autofit.py +0 -0
  29. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/autofit_manually.py +0 -0
  30. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/background.py +0 -0
  31. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/cell_indentation.py +0 -0
  32. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart.py +0 -0
  33. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_area.py +0 -0
  34. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_bar.py +0 -0
  35. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_clustered.py +0 -0
  36. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_column.py +0 -0
  37. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_combined.py +0 -0
  38. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_data_labels.py +0 -0
  39. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_data_table.py +0 -0
  40. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_data_tools.py +0 -0
  41. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_date_axis.py +0 -0
  42. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_doughnut.py +0 -0
  43. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_gauge.py +0 -0
  44. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_gradient.py +0 -0
  45. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_line.py +0 -0
  46. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_pareto.py +0 -0
  47. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_pattern.py +0 -0
  48. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_pie.py +0 -0
  49. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_radar.py +0 -0
  50. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_scatter.py +0 -0
  51. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_secondary_axis.py +0 -0
  52. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_stock.py +0 -0
  53. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chart_styles.py +0 -0
  54. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/chartsheet.py +0 -0
  55. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/check_close.py +0 -0
  56. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/checkbox.py +0 -0
  57. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/comments1.py +0 -0
  58. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/comments2.py +0 -0
  59. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/conditional_format.py +0 -0
  60. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/context_manager.py +0 -0
  61. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/data_validate.py +0 -0
  62. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/datetimes.py +0 -0
  63. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/defined_name.py +0 -0
  64. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/demo.py +0 -0
  65. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/diagonal_border.py +0 -0
  66. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/django_simple.py +0 -0
  67. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/doc_properties.py +0 -0
  68. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/dynamic_arrays.py +0 -0
  69. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/embedded_images.py +0 -0
  70. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/headers_footers.py +0 -0
  71. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/hello_world.py +0 -0
  72. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/hide_row_col.py +0 -0
  73. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/hide_sheet.py +0 -0
  74. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/http_server.py +0 -0
  75. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/hyperlink.py +0 -0
  76. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/ignore_errors.py +0 -0
  77. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/images.py +0 -0
  78. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/images_bytesio.py +0 -0
  79. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/inheritance1.py +0 -0
  80. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/inheritance2.py +0 -0
  81. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/lambda.py +0 -0
  82. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/macros.py +0 -0
  83. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/merge1.py +0 -0
  84. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/merge_rich_string.py +0 -0
  85. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/outline.py +0 -0
  86. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/outline_collapsed.py +0 -0
  87. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/pandas_autofilter.py +0 -0
  88. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/pandas_chart.py +0 -0
  89. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/pandas_chart_columns.py +0 -0
  90. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/pandas_chart_line.py +0 -0
  91. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/pandas_column_formats.py +0 -0
  92. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/pandas_conditional_format.py +0 -0
  93. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/pandas_datetime.py +0 -0
  94. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/pandas_header_format.py +0 -0
  95. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/pandas_multiple.py +0 -0
  96. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/pandas_percentage.py +0 -0
  97. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/pandas_positioning.py +0 -0
  98. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/pandas_simple.py +0 -0
  99. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/pandas_table.py +0 -0
  100. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/panes.py +0 -0
  101. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/polars_chart.py +0 -0
  102. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/polars_checkbox.py +0 -0
  103. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/polars_conditional_format.py +0 -0
  104. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/polars_format_custom.py +0 -0
  105. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/polars_format_default.py +0 -0
  106. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/polars_multiple.py +0 -0
  107. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/polars_positioning.py +0 -0
  108. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/polars_simple.py +0 -0
  109. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/polars_sparklines.py +0 -0
  110. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/polars_xlsxwriter.py +0 -0
  111. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/rich_strings.py +0 -0
  112. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/right_to_left.py +0 -0
  113. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/sensitivity_label.py +0 -0
  114. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/sparklines1.py +0 -0
  115. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/sparklines2.py +0 -0
  116. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/tab_colors.py +0 -0
  117. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/tables.py +0 -0
  118. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/text_indent.py +0 -0
  119. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/textbox.py +0 -0
  120. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/tutorial1.py +0 -0
  121. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/tutorial2.py +0 -0
  122. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/tutorial3.py +0 -0
  123. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/unicode.py +0 -0
  124. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/unicode_polish_utf8.py +0 -0
  125. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/unicode_polish_utf8.txt +0 -0
  126. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/unicode_shift_jis.py +0 -0
  127. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/unicode_shift_jis.txt +0 -0
  128. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/user_types1.py +0 -0
  129. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/user_types2.py +0 -0
  130. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/user_types3.py +0 -0
  131. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/vbaProject.bin +0 -0
  132. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/vba_extract.py +0 -0
  133. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/watermark.py +0 -0
  134. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/examples/worksheet_protection.py +0 -0
  135. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/setup.cfg +0 -0
  136. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/app.py +0 -0
  137. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/chart_area.py +0 -0
  138. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/chart_bar.py +0 -0
  139. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/chart_column.py +0 -0
  140. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/chart_doughnut.py +0 -0
  141. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/chart_line.py +0 -0
  142. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/chart_pie.py +0 -0
  143. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/chart_radar.py +0 -0
  144. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/chart_scatter.py +0 -0
  145. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/chart_stock.py +0 -0
  146. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/chartsheet.py +0 -0
  147. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/contenttypes.py +0 -0
  148. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/core.py +0 -0
  149. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/custom.py +0 -0
  150. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/exceptions.py +0 -0
  151. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/feature_property_bag.py +0 -0
  152. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/metadata.py +0 -0
  153. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/packager.py +0 -0
  154. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/relationships.py +0 -0
  155. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/rich_value.py +0 -0
  156. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/rich_value_rel.py +0 -0
  157. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/rich_value_structure.py +0 -0
  158. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/rich_value_types.py +0 -0
  159. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/sharedstrings.py +0 -0
  160. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/table.py +0 -0
  161. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/theme.py +0 -0
  162. {xlsxwriter-3.2.3 → xlsxwriter-3.2.4}/xlsxwriter/xmlwriter.py +0 -0
  163. {xlsxwriter-3.2.3/XlsxWriter.egg-info → xlsxwriter-3.2.4/xlsxwriter.egg-info}/dependency_links.txt +0 -0
  164. {xlsxwriter-3.2.3/XlsxWriter.egg-info → xlsxwriter-3.2.4/xlsxwriter.egg-info}/top_level.txt +0 -0
@@ -1,3 +1,23 @@
1
+ Release 3.2.4 - June 17 2025
2
+ ----------------------------
3
+
4
+ * Added support for a :ref:`Color() <Color>` type. This is backwards compatible
5
+ with existing Html and named color string types but also adds support for
6
+ theme colors. See also :ref:`colors`.
7
+
8
+ * Fixed issue where ``write_url()`` dropped implicit support for generic URL
9
+ types due to the refactoring into a ``Url`` type in the previous release.
10
+
11
+ :issue:`1129`.
12
+
13
+ * Fixed issue where ``max_url_length`` parameter wasn't honored.
14
+
15
+ :issue:`1130`.
16
+
17
+ * Made internal test function ``compare_xlsx_files()`` public via the Utility
18
+ module in order to facilitate similar testing by third party libraries.
19
+
20
+
1
21
  Release 3.2.3 - April 17 2025
2
22
  -----------------------------
3
23
 
@@ -26,6 +46,10 @@ Release 3.2.3 - April 17 2025
26
46
  This is part of a modernization of the XlsxWriter code base, see "XlsxWriter
27
47
  Roadmap v2" :feature:`1128`.
28
48
 
49
+ * As part of the type annotation refactoring support was added for an explicit
50
+ ``Url`` type in addition to the implicit string URLs used in previous
51
+ versions. This isn't documented in this release.
52
+
29
53
 
30
54
  Release 3.2.2 - January 28 2025
31
55
  -------------------------------
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
- Name: XlsxWriter
3
- Version: 3.2.3
2
+ Name: xlsxwriter
3
+ Version: 3.2.4
4
4
  Summary: A Python module for creating Excel XLSX files.
5
5
  Home-page: https://github.com/jmcnamara/XlsxWriter
6
6
  Author: John McNamara
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3.13
20
- Requires-Python: >=3.6
20
+ Requires-Python: >=3.8
21
21
  License-File: LICENSE.txt
22
22
  Dynamic: author
23
23
  Dynamic: author-email
@@ -0,0 +1,87 @@
1
+ ##############################################################################
2
+ #
3
+ # A demonstration of the RGB and Theme colors palettes available in the
4
+ # XlsxWriter Python module.
5
+ #
6
+ # SPDX-License-Identifier: BSD-2-Clause
7
+ #
8
+ # Copyright (c) 2013-2025, John McNamara, jmcnamara@cpan.org
9
+ #
10
+ import xlsxwriter
11
+ from xlsxwriter.color import Color
12
+
13
+ # Create a new Excel file object.
14
+ workbook = xlsxwriter.Workbook("colors.xlsx")
15
+
16
+ # Add a worksheet for the RGB colors.
17
+ worksheet = workbook.add_worksheet("RGB Colors")
18
+
19
+ # Write some predefined colors to cells.
20
+ named_colors = [
21
+ "Black",
22
+ "Blue",
23
+ "Brown",
24
+ "Cyan",
25
+ "Gray",
26
+ "Green",
27
+ "Lime",
28
+ "Magenta",
29
+ "Navy",
30
+ "Orange",
31
+ "Pink",
32
+ "Purple",
33
+ "Red",
34
+ "Silver",
35
+ "White",
36
+ "Yellow",
37
+ ]
38
+
39
+ # Write the named colors.
40
+ for row, name in enumerate(named_colors):
41
+ color_format = workbook.add_format({"bg_color": Color(name)})
42
+ worksheet.write_string(row, 0, name)
43
+ worksheet.write_blank(row, 1, None, color_format)
44
+
45
+ # Write some user-defined RGB colors to cells.
46
+ user_defined_colors = [
47
+ "#FF7F50",
48
+ "#DCDCDC",
49
+ "#6495ED",
50
+ "#DAA520",
51
+ ]
52
+
53
+ for row, name in enumerate(user_defined_colors, start=len(named_colors)):
54
+ color_format = workbook.add_format({"bg_color": Color(name)})
55
+ worksheet.write_string(row, 0, name)
56
+ worksheet.write_blank(row, 1, None, color_format)
57
+
58
+ # Add a worksheet for the Theme colors.
59
+ worksheet = workbook.add_worksheet("Theme Colors")
60
+
61
+ # Add alternative colors for the cell text.
62
+ black_text = Color("#000000")
63
+ white_text = Color("#FFFFFF")
64
+
65
+ # Create a cell with each of the theme colors.
66
+ for row in range(6):
67
+ for col in range(10):
68
+ # Use the theme color for the background.
69
+ theme_color = Color.theme(col, row)
70
+
71
+ # Use white font color for better contrast on dark backgrounds.
72
+ if col != 0:
73
+ font_color = white_text
74
+ else:
75
+ font_color = black_text
76
+
77
+ color_format = workbook.add_format(
78
+ {
79
+ "align": "center",
80
+ "bg_color": theme_color,
81
+ "font_color": font_color,
82
+ }
83
+ )
84
+ worksheet.write_string(row, col, f"({col}, {row})", color_format)
85
+
86
+ # Save the file to disk.
87
+ workbook.close()
@@ -0,0 +1,35 @@
1
+ import sys
2
+ from warnings import warn
3
+
4
+ from setuptools import setup
5
+
6
+ if sys.version_info < (3, 8):
7
+ warn("The minimum Python version supported by XlsxWriter is 3.8")
8
+ sys.exit()
9
+
10
+ setup(
11
+ name="xlsxwriter",
12
+ version="3.2.4",
13
+ author="John McNamara",
14
+ author_email="jmcnamara@cpan.org",
15
+ url="https://github.com/jmcnamara/XlsxWriter",
16
+ packages=["xlsxwriter"],
17
+ scripts=["examples/vba_extract.py"],
18
+ license="BSD-2-Clause",
19
+ description="A Python module for creating Excel XLSX files.",
20
+ long_description=open("README.rst", encoding="utf-8").read(),
21
+ classifiers=[
22
+ "Development Status :: 5 - Production/Stable",
23
+ "License :: OSI Approved :: BSD License",
24
+ "Programming Language :: Python",
25
+ "Programming Language :: Python :: 3 :: Only",
26
+ "Programming Language :: Python :: 3",
27
+ "Programming Language :: Python :: 3.8",
28
+ "Programming Language :: Python :: 3.9",
29
+ "Programming Language :: Python :: 3.10",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
32
+ "Programming Language :: Python :: 3.13",
33
+ ],
34
+ python_requires=">=3.8",
35
+ )
@@ -3,6 +3,6 @@
3
3
  #
4
4
  # Copyright (c) 2013-2025, John McNamara, jmcnamara@cpan.org
5
5
  #
6
- __version__ = "3.2.3"
6
+ __version__ = "3.2.4"
7
7
  __VERSION__ = __version__
8
8
  from .workbook import Workbook # noqa
@@ -11,11 +11,12 @@ import copy
11
11
  import re
12
12
  from warnings import warn
13
13
 
14
+ from xlsxwriter.color import Color, ColorTypes
15
+
14
16
  from . import xmlwriter
15
17
  from .shape import Shape
16
18
  from .utility import (
17
19
  _datetime_to_excel_datetime,
18
- _get_rgb_color,
19
20
  _supported_datetime,
20
21
  quote_sheetname,
21
22
  xl_range_formula,
@@ -204,7 +205,10 @@ class Chart(xmlwriter.XMLwriter):
204
205
 
205
206
  # Set the "invert if negative" fill property.
206
207
  invert_if_neg = options.get("invert_if_negative", False)
207
- inverted_color = options.get("invert_if_negative_color", False)
208
+ inverted_color = options.get("invert_if_negative_color")
209
+
210
+ if inverted_color:
211
+ inverted_color = Color._from_value(inverted_color)
208
212
 
209
213
  # Set the secondary axis properties.
210
214
  x2_axis = options.get("x2_axis")
@@ -845,6 +849,9 @@ class Chart(xmlwriter.XMLwriter):
845
849
  if font["rotation"]:
846
850
  font["rotation"] = 60000 * int(font["rotation"])
847
851
 
852
+ if font.get("color"):
853
+ font["color"] = Color._from_value(font["color"])
854
+
848
855
  return font
849
856
 
850
857
  def _list_to_formula(self, data):
@@ -1889,7 +1896,7 @@ class Chart(xmlwriter.XMLwriter):
1889
1896
 
1890
1897
  self._xml_end_tag("c:ser")
1891
1898
 
1892
- def _write_c_ext_lst_inverted_color(self, color):
1899
+ def _write_c_ext_lst_inverted_color(self, color: Color):
1893
1900
  # Write the <c:extLst> element for the inverted fill color.
1894
1901
 
1895
1902
  uri = "{6F2FDCE9-48DA-4B69-8628-5D25D57E5C99}"
@@ -3156,7 +3163,7 @@ class Chart(xmlwriter.XMLwriter):
3156
3163
  style_attributes = Shape._get_font_style_attributes(font)
3157
3164
  latin_attributes = Shape._get_font_latin_attributes(font)
3158
3165
 
3159
- if font and font.get("color") is not None:
3166
+ if font and font.get("color"):
3160
3167
  has_color = True
3161
3168
 
3162
3169
  if latin_attributes or has_color:
@@ -3201,7 +3208,7 @@ class Chart(xmlwriter.XMLwriter):
3201
3208
  style_attributes = Shape._get_font_style_attributes(font)
3202
3209
  latin_attributes = Shape._get_font_latin_attributes(font)
3203
3210
 
3204
- if font and font["color"] is not None:
3211
+ if font and font["color"]:
3205
3212
  has_color = True
3206
3213
 
3207
3214
  # Add the lang type to the attributes.
@@ -3362,17 +3369,46 @@ class Chart(xmlwriter.XMLwriter):
3362
3369
 
3363
3370
  self._xml_start_tag("a:solidFill")
3364
3371
 
3365
- if "color" in fill:
3366
- color = _get_rgb_color(fill["color"])
3367
- transparency = fill.get("transparency")
3372
+ if fill.get("color"):
3373
+ self._write_color(fill["color"], fill.get("transparency"))
3374
+
3375
+ self._xml_end_tag("a:solidFill")
3376
+
3377
+ def _write_color(self, color: Color, transparency=None):
3378
+ # Write the appropriate chart color element.
3379
+
3380
+ if not color:
3381
+ return
3382
+
3383
+ if color._is_automatic:
3384
+ # Write the a:sysClr element.
3385
+ self._write_a_sys_clr()
3386
+ elif color._type == ColorTypes.RGB:
3368
3387
  # Write the a:srgbClr element.
3369
3388
  self._write_a_srgb_clr(color, transparency)
3389
+ elif color._type == ColorTypes.THEME:
3390
+ self._write_a_scheme_clr(color, transparency)
3370
3391
 
3371
- self._xml_end_tag("a:solidFill")
3392
+ def _write_a_sys_clr(self):
3393
+ # Write the <a:sysClr> element.
3372
3394
 
3373
- def _write_a_srgb_clr(self, val, transparency=None):
3395
+ val = "window"
3396
+ last_clr = "FFFFFF"
3397
+
3398
+ attributes = [
3399
+ ("val", val),
3400
+ ("lastClr", last_clr),
3401
+ ]
3402
+
3403
+ self._xml_empty_tag("a:sysClr", attributes)
3404
+
3405
+ def _write_a_srgb_clr(self, color: Color, transparency=None):
3374
3406
  # Write the <a:srgbClr> element.
3375
- attributes = [("val", val)]
3407
+
3408
+ if not color:
3409
+ return
3410
+
3411
+ attributes = [("val", color._rgb_hex_value())]
3376
3412
 
3377
3413
  if transparency:
3378
3414
  self._xml_start_tag("a:srgbClr", attributes)
@@ -3384,6 +3420,42 @@ class Chart(xmlwriter.XMLwriter):
3384
3420
  else:
3385
3421
  self._xml_empty_tag("a:srgbClr", attributes)
3386
3422
 
3423
+ def _write_a_scheme_clr(self, color: Color, transparency=None):
3424
+ # Write the <a:schemeClr> element.
3425
+ scheme, lum_mod, lum_off = color._chart_scheme()
3426
+ attributes = [("val", scheme)]
3427
+
3428
+ if lum_mod > 0 or lum_off > 0 or transparency:
3429
+ self._xml_start_tag("a:schemeClr", attributes)
3430
+
3431
+ if lum_mod > 0:
3432
+ # Write the a:lumMod element.
3433
+ self._write_a_lum_mod(lum_mod)
3434
+
3435
+ if lum_off > 0:
3436
+ # Write the a:lumOff element.
3437
+ self._write_a_lum_off(lum_off)
3438
+
3439
+ if transparency:
3440
+ # Write the a:alpha element.
3441
+ self._write_a_alpha(transparency)
3442
+
3443
+ self._xml_end_tag("a:schemeClr")
3444
+ else:
3445
+ self._xml_empty_tag("a:schemeClr", attributes)
3446
+
3447
+ def _write_a_lum_mod(self, value: int):
3448
+ # Write the <a:lumMod> element.
3449
+ attributes = [("val", value)]
3450
+
3451
+ self._xml_empty_tag("a:lumMod", attributes)
3452
+
3453
+ def _write_a_lum_off(self, value: int):
3454
+ # Write the <a:lumOff> element.
3455
+ attributes = [("val", value)]
3456
+
3457
+ self._xml_empty_tag("a:lumOff", attributes)
3458
+
3387
3459
  def _write_a_alpha(self, val):
3388
3460
  # Write the <a:alpha> element.
3389
3461
 
@@ -4279,9 +4351,7 @@ class Chart(xmlwriter.XMLwriter):
4279
4351
  attributes = [("pos", pos)]
4280
4352
  self._xml_start_tag("a:gs", attributes)
4281
4353
 
4282
- # Write the a:srgbClr element.
4283
- color = _get_rgb_color(color)
4284
- self._write_a_srgb_clr(color)
4354
+ self._write_color(color)
4285
4355
 
4286
4356
  self._xml_end_tag("a:gs")
4287
4357
 
@@ -4357,26 +4427,14 @@ class Chart(xmlwriter.XMLwriter):
4357
4427
 
4358
4428
  self._xml_end_tag("a:pattFill")
4359
4429
 
4360
- def _write_a_fg_clr(self, color):
4430
+ def _write_a_fg_clr(self, color: Color):
4361
4431
  # Write the <a:fgClr> element.
4362
-
4363
- color = _get_rgb_color(color)
4364
-
4365
4432
  self._xml_start_tag("a:fgClr")
4366
-
4367
- # Write the a:srgbClr element.
4368
- self._write_a_srgb_clr(color)
4369
-
4433
+ self._write_color(color)
4370
4434
  self._xml_end_tag("a:fgClr")
4371
4435
 
4372
- def _write_a_bg_clr(self, color):
4436
+ def _write_a_bg_clr(self, color: Color):
4373
4437
  # Write the <a:bgClr> element.
4374
-
4375
- color = _get_rgb_color(color)
4376
-
4377
4438
  self._xml_start_tag("a:bgClr")
4378
-
4379
- # Write the a:srgbClr element.
4380
- self._write_a_srgb_clr(color)
4381
-
4439
+ self._write_color(color)
4382
4440
  self._xml_end_tag("a:bgClr")