Bringing theme colors to ODF

Regina Henschel rb.henschel at t-online.de
Wed Mar 29 11:53:22 UTC 2023


Hi Tomaž,

I have attached a "using elements with names" compared to "using a list".
In case of "using a list", referencing a scheme color would be done via 
index and not via name.

Please tell me, what is your preferred solution.

Kind regards,
Regina

Regina Henschel schrieb am 29.03.2023 um 10:28:
> Hi Tomaž,
> 
> Tomaž Vajngerl schrieb am 25.03.2023 um 11:10:
>> Hi Regina,
>>
> [..]
>> OTOH it probably makes sense to rename dk1, lt1, dk2, lt2, hlink, 
>> folHlink to the full names dark1, light1, ... , hyperlink, 
>> followed-hyperlink - which is inline with ODF style to not to 
>> abbreviate things. I planned to do that change but other things have 
>> priority currently.
> 
> Do we need names at all in the relaxNG schema? The colors could be put 
> as space separated list into one attribute. Such list is ordered too.
> 
> Kind regards,
> Regina
> 
> 
> 
> 

-------------- next part --------------
===========================
= Version with value list =
===========================

Resulting markup example
------------------------
<draw:color-scheme draw:color-scheme-name="Regina"
  draw:scheme-colors="#000000 #ffffff #000011 #ffff01 #100000 #020000 #003000 #000400 #000050 #000006 #0000ff #3300ff"/>

NN <draw:color-scheme>
----------------------
The <draw:color-scheme> element has a draw:color-scheme-name attribute and a draw:scheme-colors attribute.
The draw:color-scheme-name attribute helps consumers to organize color schemes in an application.
The draw:scheme-colors attribute is a space separated list of twelve sRGB colors in #rrbbgg notation. They are usually used in the meaning dark1, light1, dark2, light2, accent1, accent2, accent3, accent4, accent5, accent6, hyperlink, followedhyperlink.

The <draw:color-scheme> element is usable with the following element: <draw:theme>.
The <draw:color-scheme> element has the following attributes: draw:color-scheme-name, draw:scheme-colors
The <draw:color-scheme> element has no child elements.

RelaxNG
------
<rng:define name="draw-color-scheme">
  <rng:element name="draw:color-scheme">
    <rng:attribute name="draw:color-scheme-name">
      <rng:ref name="string"/>
    </rng:attribute>
    <rng:attribute name=”draw:scheme-colors”>
      <rng:list>
        <rng:ref name="color"/>
        <rng:ref name="color"/>
        <rng:ref name="color"/>
        <rng:ref name="color"/>
        <rng:ref name="color"/>
        <rng:ref name="color"/>
        <rng:ref name="color"/>
        <rng:ref name="color"/>
        <rng:ref name="color"/>
        <rng:ref name="color"/>
        <rng:ref name="color"/>
        <rng:ref name="color"/>
      </rng:list>
    </rng:attribute>
    <rng:empty/>
  </rng:element>
</rng:define>


=========================
= Version with elements =
=========================

Resulting markup example
------------------------
<draw:color-scheme draw:color-scheme-name="Regina">
  <draw:scheme-color draw:scheme-color-name="dark1" draw:scheme-color-value="#000000"/>
  <draw:scheme-color draw:scheme-color-name="light1" draw:scheme-color-value="#ffffff"/>
  <draw:scheme-color draw:scheme-color-name="dark2" draw:scheme-color-value="#000011"/>
  <draw:scheme-color draw:scheme-color-name="light2" draw:scheme-color-value="#ffff01"/>
  <draw:scheme-color draw:scheme-color-name="accent1" draw:scheme-color-value="#100000"/>
  <draw:scheme-color draw:scheme-color-name="accent2" draw:scheme-color-value="#020000"/>
  <draw:scheme-color draw:scheme-color-name="accent3" draw:scheme-color-value="#003000"/>
  <draw:scheme-color draw:scheme-color-name="accent4" draw:scheme-color-value="#000400"/>
  <draw:scheme-color draw:scheme-color-name="accent5" draw:scheme-color-value="#000050"/>
  <draw:scheme-color draw:scheme-color-name="accent6" draw:scheme-color-value="#000006"/>
  <draw:scheme-color draw:scheme-color-name="hyperlink" draw:scheme-color-value="#0000ff"/>
  <draw:scheme-color draw:scheme-color-name="followedHyperlink" draw:scheme-color-value="#3300ff"/>
</draw:color-scheme>

NN <draw:color-scheme>
----------------------
The <draw:color-scheme> element has a draw:color-scheme-name attribute and twelve <draw:scheme-color> child elements for the colors.
The draw:color-scheme-name attribute helps consumers to organize color schemes in an application.
A <draw:scheme-color> element has a draw:scheme-color-name attribute so that the color can be uses by reference and a draw:scheme-color-value attribute for the color value.

The <draw:color-scheme> element is usable with the following element: <draw:theme>.
The <draw:color-scheme> element has the following attribute: draw:color-scheme-name.
The <draw:color-scheme> element has the following child element: <draw:scheme-color>

RelaxNG
-------
<rng:define name="draw-color-scheme">
  <rng:element name="draw:color-scheme">
    <rng:attribute name="draw:color-scheme-name">
      <rng:ref name="string"/>
    </rng:attribute>
    <rng:ref name="draw-scheme-colors"/>
  </rng:element>
</rng:define>

<rng:define name="draw-scheme-colors">
  <rng:element name="draw:scheme-color">
    <rng:attribute name="draw:scheme-color-name">
      <value>dark1</value>
    </rng:attribute>
    <rng:attribute name="draw:scheme-color-value">
      <rng:ref name="Color"/>
    </rng:attribute>
  </rng:element>
  <rng:element name="draw:scheme-color">
    <rng:attribute name="draw:scheme-color-name">
      <value>light1</value>
    </rng:attribute>
    <rng:attribute name="draw:scheme-color-value">
      <rng:ref name="Color"/>
    </rng:attribute>
  </rng:element>
  <rng:element name="draw:scheme-color">
    <rng:attribute name="draw:scheme-color-name">
      <value>dark2</value>
    </rng:attribute>
    <rng:attribute name="draw:scheme-color-value">
      <rng:ref name="Color"/>
    </rng:attribute>
  </rng:element>
  <rng:element name="draw:scheme-color">
    <rng:attribute name="draw:scheme-color-name">
      <value>light2</value>
    </rng:attribute>
    <rng:attribute name="draw:scheme-color-value">
      <rng:ref name="Color"/>
    </rng:attribute>
  </rng:element>
  <rng:element name="draw:scheme-color">
    <rng:attribute name="draw:scheme-color-name">
      <value>accent1</value>
    </rng:attribute>
    <rng:attribute name="draw:scheme-color-value">
      <rng:ref name="Color"/>
    </rng:attribute>
  </rng:element>
  <rng:element name="draw:scheme-color">
    <rng:attribute name="draw:scheme-color-name">
      <value>accent2</value>
    </rng:attribute>
    <rng:attribute name="draw:scheme-color-value">
      <rng:ref name="Color"/>
    </rng:attribute>
  </rng:element>
  <rng:element name="draw:scheme-color">
    <rng:attribute name="draw:scheme-color-name">
      <value>accent3</value>
    </rng:attribute>
    <rng:attribute name="draw:scheme-color-value">
      <rng:ref name="Color"/>
    </rng:attribute>
  </rng:element>
  <rng:element name="draw:scheme-color">
    <rng:attribute name="draw:scheme-color-name">
      <value>accent4</value>
    </rng:attribute>
    <rng:attribute name="draw:scheme-color-value">
      <rng:ref name="Color"/>
    </rng:attribute>
  </rng:element>
  <rng:element name="draw:scheme-color">
    <rng:attribute name="draw:scheme-color-name">
      <value>accent5</value>
    </rng:attribute>
    <rng:attribute name="draw:scheme-color-value">
      <rng:ref name="Color"/>
    </rng:attribute>
  </rng:element>
  <rng:element name="draw:scheme-color">
    <rng:attribute name="draw:scheme-color-name">
      <value>accent6</value>
    </rng:attribute>
    <rng:attribute name="draw:scheme-color-value">
      <rng:ref name="Color"/>
    </rng:attribute>
  </rng:element>
  <rng:element name="draw:scheme-color">
    <rng:attribute name="draw:scheme-color-name">
      <value>hyperlink</value>
    </rng:attribute>
    <rng:attribute name="draw:scheme-color-value">
      <rng:ref name="Color"/>
    </rng:attribute>
  </rng:element>
  <rng:element name="draw:scheme-color">
    <rng:attribute name="draw:scheme-color-name">
      <value>followedHyperlink</value>
    </rng:attribute>
    <rng:attribute name="draw:scheme-color-value">
      <rng:ref name="Color"/>
    </rng:attribute>
  </rng:element>
</rng:define>



More information about the LibreOffice mailing list