Reputation: 482
I'm looking to make a basic tumblr profile using the 101 theme (https://www.tumblr.com/theme/483) which is white and every entry has a different color depending on what type of post it is, so for example, a regular entry could be blue and a video entry could be green.
I know this is defined using the metaname
option; <meta name="color:Regular Entry" content="#000000"/>
and then calling it in the CSS of the theme:
.regular,
.conversation,
.quote{
background-color:{color:Regular Entry};
}
I want to know if there is anyway to change this background color based on the tag of the post?
So, eg, say I only post regular entries but every one has a specific tag, out of a possible 6, which are all defined using <meta name="color:tag1" content="#000000"/>
up to tag6. Is there a way to make the regular entry post change its bg color based on this?
Thanks
Upvotes: 0
Views: 201
Reputation: 96567
In your theme, add the {TagsAsClasses}
variable to the element containing a single post, for example, as value of the class
attribute:
<article class="post {TagsAsClasses}">
If you have tagged a post with "Foobar", you’ll find the class
value foobar
in the markup, e.g.:
<article class="post foobar">
<!-- … -->
</article>
You can use this as a hook in your CSS:
.foobar {background-color:red;}
Side note: If you don’t want your users to use/see these tags, you can use a _
prefix, as explained in Tumblr’s staff blog.
Upvotes: 2