diff --git a/docs/theming-guide.adoc b/docs/theming-guide.adoc index 7353cf7e7..7d44603d3 100644 --- a/docs/theming-guide.adoc +++ b/docs/theming-guide.adoc @@ -1306,6 +1306,10 @@ Block styles are applied to the following block types: |<> |background_color: #ffffff +|table_head_background_color +|<> +|background_color: #f0f0f0 + |table_even_row_background_color |<> |even_row_background_color: #f9f9f9 @@ -1314,6 +1318,30 @@ Block styles are applied to the following block types: |<> |foot_background_color: #f0f0f0 +|table_header_cell_align +|left, center, right +|align: center + +|table_header_cell_background_color +|<> +|background_color: #f0f0f0 + +|table_header_cell_font_color +|<> +|font_color: #1a1a1a + +|table_header_cell_font_family +|<> +|font_family: Noto Sans + +|table_header_cell_font_size +|<> +|font_size: 12 + +|table_header_cell_font_style +|normal, italic, bold, bold_italic +|font_style: italic + |table_border_color |<> |border_color: #dddddd diff --git a/lib/asciidoctor-pdf/converter.rb b/lib/asciidoctor-pdf/converter.rb index fdca037d9..483e04f13 100644 --- a/lib/asciidoctor-pdf/converter.rb +++ b/lib/asciidoctor-pdf/converter.rb @@ -1163,8 +1163,29 @@ def convert_table node case cell.style when :emphasis cell_data[:font_style] = :italic - when :strong, :header + when :strong cell_data[:font_style] = :bold + when :header + unless defined? header_cell_data + header_cell_data = {} + { + 'align' => :align, + 'font_color' => :text_color, + 'font_family' => :font, + 'font_size' => :size, + 'font_style' => :font_style + }.each do |theme_key, key| + if (val = theme[%(table_header_cell_#{theme_key})]) + header_cell_data[key] = val + end + end + header_cell_data[:font_style] ||= :bold + if (val = resolve_theme_color :table_header_cell_background_color) + header_cell_data[:background_color] = val + end + end + + cell_data.update header_cell_data unless header_cell_data.empty? when :monospaced cell_data[:font] = theme.literal_font_family if (size = theme.literal_font_size)