chiark / gitweb /
css: support for colored figures.
authorVladimír Vondruš <mosra@centrum.cz>
Mon, 1 Jan 2018 18:41:28 +0000 (19:41 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Mon, 1 Jan 2018 20:31:20 +0000 (21:31 +0100)
css/m-components.css
doc/css/components-test.rst
doc/css/components.rst

index e042a8de2bcfefac38b90f017a9dec55bfd6eb39..1463c368cce12285059c041b5a33e8943629808f 100644 (file)
@@ -1118,6 +1118,26 @@ article section:target figure.m-code-figure, article section:target figure.m-con
   z-index: 1; /* so the selection border isn't above figure border */
 }
 
+/* Colored figure */
+figure.m-figure.m-default:before { border-color: var(--default-filled-background-color); }
+figure.m-figure.m-default figcaption { color: var(--default-color); }
+figure.m-figure.m-primary:before { border-color: var(--primary-filled-background-color); }
+figure.m-figure.m-primary figcaption { color: var(--primary-color); }
+figure.m-figure.m-success:before { border-color: var(--success-filled-background-color); }
+figure.m-figure.m-success figcaption { color: var(--success-color); }
+figure.m-figure.m-warning:before { border-color: var(--warning-filled-background-color); }
+figure.m-figure.m-warning figcaption { color: var(--warning-color); }
+figure.m-figure.m-danger:before { border-color: var(--danger-filled-background-color); }
+figure.m-figure.m-danger figcaption { color: var(--danger-color); }
+figure.m-figure.m-info:before { border-color: var(--info-filled-background-color); }
+figure.m-figure.m-info figcaption { color: var(--info-color); }
+figure.m-figure.m-dim:before { border-color: var(--dim-filled-background-color); }
+figure.m-figure.m-dim { color: var(--dim-color); }
+figure.m-figure.m-dim a { color: var(--dim-link-color); }
+figure.m-figure.m-dim a:hover, figure.m-figure.m-dim a:focus, figure.m-figure.m-dim a:active {
+  color: var(--dim-link-active-color);
+}
+
 /* Image grid */
 .m-imagegrid > div {
   background-color: var(--background-color); /* to avoid section HL shining through */
index a7057e5f701c021761beeffeeda025f674cd16c3..4864c8df8efc3ea01274694bc88031c4599e8e03 100644 (file)
@@ -918,6 +918,64 @@ instead of extending the border and there should be proper padding on bottom):
       <figcaption>A Somewhat Lengthy Caption For A Photo</figcaption>
     </figure>
 
+Figures of varying colors:
+
+.. raw:: html
+
+    <div class="m-row">
+      <div class="m-col-m-3 m-col-s-6">
+        <figure class="m-figure m-default">
+          <img src="{filename}/static/ship-small.jpg" />
+          <figcaption>Default figure</figcaption>
+          <span>Text.</span>
+        </figure>
+      </div>
+      <div class="m-col-m-3 m-col-s-6">
+        <figure class="m-figure m-primary">
+          <img src="{filename}/static/ship-small.jpg" />
+          <figcaption>Primary figure</figcaption>
+          <span>Text.</span>
+        </figure>
+      </div>
+      <div class="m-col-m-3 m-col-s-6">
+        <figure class="m-figure m-success">
+          <img src="{filename}/static/ship-small.jpg" />
+          <figcaption>Success figure</figcaption>
+          <span>Text.</span>
+        </figure>
+      </div>
+      <div class="m-col-m-3 m-col-s-6">
+        <figure class="m-figure m-warning">
+          <img src="{filename}/static/ship-small.jpg" />
+          <figcaption>Warning figure</figcaption>
+          <span>Text.</span>
+        </figure>
+      </div>
+    </div>
+    <div class="m-row">
+      <div class="m-col-m-3 m-col-s-6">
+        <figure class="m-figure m-danger">
+          <img src="{filename}/static/ship-small.jpg" />
+          <figcaption>Danger figure</figcaption>
+          <span>Text.</span>
+        </figure>
+      </div>
+      <div class="m-col-m-3 m-col-s-6">
+        <figure class="m-figure m-info">
+          <img src="{filename}/static/ship-small.jpg" />
+          <figcaption>Info figure</figcaption>
+          <span>Text.</span>
+        </figure>
+      </div>
+      <div class="m-col-m-3 m-col-s-6">
+        <figure class="m-figure m-dim">
+          <img src="{filename}/static/ship-small.jpg" />
+          <figcaption>Dim figure</figcaption>
+          <span>Text.</span>
+        </figure>
+      </div>
+    </div>
+
 Image grid
 ==========
 
index 12bbd26b848585f8364bd0c76122b35992564904..ca95727453d3a1436b0829ed2a497067be5b8469 100644 (file)
@@ -652,6 +652,8 @@ wrapped in some tag as well (for example a :html:`<span>`). The
 Figure always expects at least the caption to be present. If you want just an
 image, use the plain image tag. If you have a lot of figures on the page and
 the border is distracting, apply the :css:`.m-flat` class to hide it.
+Optionally you can color the figure border and caption by adding one of the
+`CSS color classes <#colors>`_ to the :html:`<figure>` element.
 
 .. code-figure::