From 987bfcfd5b49b992e5fd45f3428497f6f55cae53 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Wed, 1 Apr 2015 18:28:33 +0100 Subject: [PATCH] Add background image to Vanilla theme tweaks Now one can choose an image tiddler from a dropdown and choose how the image is attached. --- themes/tiddlywiki/vanilla/ThemeTweaks.tid | 35 +++++++++++++++++++++-- themes/tiddlywiki/vanilla/base.tid | 18 ++++++++++++ 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/themes/tiddlywiki/vanilla/ThemeTweaks.tid b/themes/tiddlywiki/vanilla/ThemeTweaks.tid index 90f7e5556..30a58f23c 100644 --- a/themes/tiddlywiki/vanilla/ThemeTweaks.tid +++ b/themes/tiddlywiki/vanilla/ThemeTweaks.tid @@ -2,17 +2,46 @@ title: $:/themes/tiddlywiki/vanilla/themetweaks tags: $:/tags/ControlPanel/Appearance caption: Theme Tweaks +\define backgroundimage-dropdown() +
+<$button popup=<> class="tc-btn-invisible tc-btn-dropdown">{{$:/core/images/down-arrow}} +<$reveal state=<> type="popup" position="belowleft" text="" default=""> +
+<$linkcatcher to="$:/themes/tiddlywiki/vanilla/settings/backgroundimage"> +<$link to=""> +(none) + +
+<$list filter="[all[shadows+tiddlers]is[image]] -[type[application/pdf]] +[sort[title]]"> +<$link to={{!!title}}> +<$transclude/> <$view field="title"/> + + + +
+ +
+\end + +\define backgroundimageattachment-dropdown() +<$select tiddler="$:/themes/tiddlywiki/vanilla/settings/backgroundimageattachment" default="scroll"> + + + +\end + You can tweak certain aspects of the ''Vanilla'' theme. ! Options |[[Sticky titles|$:/themes/tiddlywiki/vanilla/options/stickytitles]]
//Causes tiddler titles to "stick" to the top of the browser window. Does not work at all with Chrome, and causes some layout issues in Firefox// |<$select tiddler="$:/themes/tiddlywiki/vanilla/options/stickytitles"> | - ! Settings -|[[Font family|$:/themes/tiddlywiki/vanilla/settings/fontfamily]] |<$edit-text tiddler="$:/themes/tiddlywiki/vanilla/settings/fontfamily" default="" tag="input"/> | -|[[Code font family|$:/themes/tiddlywiki/vanilla/settings/codefontfamily]] |<$edit-text tiddler="$:/themes/tiddlywiki/vanilla/settings/codefontfamily" default="" tag="input"/> | +|[[Font family|$:/themes/tiddlywiki/vanilla/settings/fontfamily]] |<$edit-text tiddler="$:/themes/tiddlywiki/vanilla/settings/fontfamily" default="" tag="input"/> | | +|[[Code font family|$:/themes/tiddlywiki/vanilla/settings/codefontfamily]] |<$edit-text tiddler="$:/themes/tiddlywiki/vanilla/settings/codefontfamily" default="" tag="input"/> | | +|[[Page background image|$:/themes/tiddlywiki/vanilla/settings/backgroundimage]] |<$edit-text tiddler="$:/themes/tiddlywiki/vanilla/settings/backgroundimage" default="" tag="input"/> |<> | +|[[Page background image attachment |$:/themes/tiddlywiki/vanilla/settings/backgroundimageattachment]] |<> | | ! Sizes diff --git a/themes/tiddlywiki/vanilla/base.tid b/themes/tiddlywiki/vanilla/base.tid index a2cfcb296..e1f67848d 100644 --- a/themes/tiddlywiki/vanilla/base.tid +++ b/themes/tiddlywiki/vanilla/base.tid @@ -1,7 +1,24 @@ title: $:/themes/tiddlywiki/vanilla/base tags: [[$:/tags/Stylesheet]] +\define custom-background-datauri() +<$reveal state="$:/themes/tiddlywiki/vanilla/settings/backgroundimage" type="nomatch" text=""> +<$set name="background" value={{$:/themes/tiddlywiki/vanilla/settings/backgroundimage}}> +<$list filter="[is[image]]"> +<$list filter="[!has[_canonical_uri]]"> +`background: url(`<$macrocall $name="datauri" title={{$:/themes/tiddlywiki/vanilla/settings/backgroundimage}}/>`);` + +<$list filter="[has[_canonical_uri]]"> +`background: url(`<$view tiddler={{$:/themes/tiddlywiki/vanilla/settings/backgroundimage}} field="_canonical_uri"/>`);` + +`background-attachment: `{{$:/themes/tiddlywiki/vanilla/settings/backgroundimageattachment}}`;` + + + +\end + \rules only filteredtranscludeinline transcludeinline macrodef macrocallinline + /* ** Start with the normalize CSS reset, and then belay some of its effects */ @@ -39,6 +56,7 @@ body.tc-body { color: <>; background-color: <>; word-wrap: break-word; + <> } h1, h2, h3, h4, h5, h6 {