metanorma / metanorma-ogc

Metanorma processor for OGC documents
https://www.metanorma.com
BSD 2-Clause "Simplified" License
2 stars 3 forks source link

Use presentation-metadata for colours #698

Closed opoudjis closed 3 weeks ago

opoudjis commented 1 month ago

From https://github.com/metanorma/metanorma-ogc/issues/673:

colours are going to be included in Presentation XML metadata from now on, including the logic about the dependence of colours on the schema. That is so that there is a single source of truth about colours for both HTML and PDF:

    <presentation-metadata>
      <name>color_main</name>
      <value>rgb(88, 89, 91)</value>
    </presentation-metadata>
    <presentation-metadata>
      <name>color_design</name>
      <value>rgb(237, 193, 35)</value>
    </presentation-metadata>
    <presentation-metadata>
      <name>color_design_light</name>
      <value>rgb(246, 223, 140)</value>
    </presentation-metadata>
    <presentation-metadata>
      <name>color_dl_dt</name>
      <value>rgb(215, 243, 255)</value>
    </presentation-metadata>
    <presentation-metadata>
      <name>color_dl_dd</name>
      <value>rgb(242, 251, 255)</value>
    </presentation-metadata>
    <presentation-metadata>
      <name>color_blue</name>
      <value>rgb(33, 55, 92)</value>
    </presentation-metadata>
    <presentation-metadata>
      <name>color_background_blue</name>
      <value>rgb(33, 60, 107)</value>
    </presentation-metadata>
    <presentation-metadata>
      <name>color_preferred</name>
      <value>rgb(249, 235, 187)</value>
    </presentation-metadata>
    <presentation-metadata>
      <name>color_deprecated</name>
      <value>rgb(237, 237, 238)</value>
    </presentation-metadata>
    <presentation-metadata>
      <name>color_admitted</name>
      <value>rgb(223, 236, 249)</value>
    </presentation-metadata>
ronaldtse commented 1 month ago

For the names of the colors can we make them meaningful? Since this is an exercise we would likely not revisit in a long time. Thanks.

Intelligent2013 commented 1 month ago

I propose to rename the colors as follows

Also, there are more colors that should be added:

opoudjis commented 1 month ago

OK, that's fine by me. I will note though that I am having trouble with the mapping to the HTML colours, and I may have questions.

Proceeding with these renamings.

opoudjis commented 1 month ago

Oh, for the distinction between deprecated and admitted: I see that in Presentation XML, both are labelled "AdmittedLabel". I will change deprecated to be labelled "DeprecatedLabel", to simplify the test; I had not been differentiating them until now.

opoudjis commented 1 month ago
  <metanorma-extension>
       <presentation-metadata>
       <name>color-admonition-caution</name>
       <value>rgb(79, 129, 189)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-admonition-editor</name>
       <value>rgb(79, 129, 189)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-admonition-important</name>
       <value>rgb(79, 129, 189)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-admonition-note</name>
       <value>rgb(79, 129, 189)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-admonition-safety-precaution</name>
       <value>rgb(79, 129, 189)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-admonition-tip</name>
       <value>rgb(79, 129, 189)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-admonition-todo</name>
       <value>rgb(79, 129, 189)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-admonition-warning</name>
       <value>rgb(79, 129, 189)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-background-definition-description</name>
       <value>rgb(242, 251, 255)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-background-definition-term</name>
       <value>rgb(215, 243, 255)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-background-page</name>
       <value>rgb(33, 55, 92)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-background-table-header</name>
       <value>rgb(33, 55, 92)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-background-table-row-even</name>
       <value>rgb(252, 246, 222)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-background-table-row-odd</name>
       <value>rgb(254, 252, 245)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-background-term-admitted-label</name>
       <value>rgb(223, 236, 249)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-background-term-deprecated-label</name>
       <value>rgb(237, 237, 238)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-background-term-preferred-label</name>
       <value>rgb(249, 235, 187)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-background-text-label-legacy</name>
       <value>rgb(33, 60, 107)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-secondary-shade-1</name>
       <value>rgb(237, 193, 35)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-secondary-shade-2</name>
       <value>rgb(246, 223, 140)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-text</name>
       <value>rgb(88, 89, 91)</value>
     </presentation-metadata>
     <presentation-metadata>
       <name>color-text-title</name>
       <value>rgb(33, 55, 92)</value>
     </presentation-metadata>
      <presentation-metadata>
        <name>TOC Heading Levels</name>
        <value>2</value>
      </presentation-metadata>
      <presentation-metadata>
        <name>HTML TOC Heading Levels</name>
        <value>2</value>
      </presentation-metadata>
      <presentation-metadata>
        <name>DOC TOC Heading Levels</name>
        <value>2</value>
      </presentation-metadata>
      <presentation-metadata>
        <name>PDF TOC Heading Levels</name>
        <value>2</value>
      </presentation-metadata>
    </metanorma-extension>
Intelligent2013 commented 1 month ago

OGC XSLT updated in https://github.com/metanorma/mn-native-pdf/pull/720. PR need to merge after metanorma-ogc update only.

opoudjis commented 1 month ago

I've submitted the HTML outputs for review, I'll ask that they get to it this week...

ronaldtse commented 1 month ago

@opoudjis there is a mention here for legacy colors being outputted with the *-legacy prefix.

We should actually refactor out the legacy design to a new "layout" like we have for ISO, so it is consistent across flavors.

opoudjis commented 1 month ago

@opoudjis there is a mention here for legacy colors being outputted with the *-legacy prefix.

We should actually refactor out the legacy design to a new "layout" like we have for ISO, so it is consistent across flavors.

You misunderstand:

Note: for background color for the label Legacy and bottom text about 'legacy' document on the cover page

This is not a legacy colour, and it will not be treated as one.

ronaldtse commented 1 month ago

OK, thanks @opoudjis .

opoudjis commented 4 weeks ago

This is going to take months to resolve, @Intelligent2013, I'm going to try and create a version of the PR that leaves the PDF unaffected. But for now, ignore all rendering colours associated with admonitions, and stick with original colours.

Intelligent2013 commented 4 weeks ago

Updated OGC XSLT in PR https://github.com/metanorma/mn-native-pdf/pull/720. On hold.

Intelligent2013 commented 3 weeks ago

I've added the default colors into OGC XSLT. They will be applied if colors are missing in the presentation-metadata.

opoudjis commented 2 weeks ago

Really sorry about the delay. I will merge the PR and ignore it in my HTML CSS, so at least you won't be impacted.