Danbooru

Custom CSS Thread

Posted under General

tapnek said:

Is there any CSS code that makes flagged posts have a red border again?

.post-preview.post-status-flagged img {
    border-color: #F00;
}

tapnek said:

Is there any CSS code that makes flagged posts have a red border again?

BrokenEagle98’s version clobbers parent/child status. If you also want the green/red and yellow/red borders for flagged parent and child posts, use these:

.post-preview.post-status-has-children.post-status-flagged img {border-color: lime red red lime}
.post-preview.post-status-has-parent.post-status-flagged img {border-color: #CC0 red red #CC0}
.post-preview.post-status-flagged img {border-color: red}

Thanks, that works. Now I just need help getting a purple border around banned posts. I tried copying the same code but replacing flagged with banned and red with purple and it didn't work.

tapnek said:

Thanks, that works. Now I just need help getting a purple border around banned posts. I tried copying the same code but replacing flagged with banned and red with purple and it didn't work.

.post-preview[data-flags~="banned"] img {
	border-color:#F0F !important;
}

If you want purple no matter what...

.post-preview[data-flags="banned"] img {
    border-color: #F0F;
}

...or using kittey's variant above...

.post-preview.post-status-has-children[data-flags="banned"] img {border-color: lime #F0F #F0F lime}
.post-preview.post-status-has-parent[data-flags="banned"] img {border-color: #CC0 #F0F #F0F #CC0}
.post-preview[data-flags="banned"] img {border-color: #F0F}

Is it possible to autofocus the tag blacklist textarea in Settings with CSS? I tried the following, but it doesn't seem to do anything:
textarea#user_blacklisted_tags { autofocus }

The following is an example of an icon overlay that can be used for post information visualization. For the following example, it indicates that the post is part of a pool, although it can be adapted to indicate other data conditions as well.

Note: The below is mostly the same CSS code used to display the animation icon for animated pictures.

#c-posts .post-preview[data-pools^="pool:"]:after,
#c-comments .post-preview[data-pools^="pool:"] .preview:after {
    content: "P";
    position: absolute;
    width: 20px;
    height: 20px;
    color: white;
    font-weight: bold;
    background-color: rgba(0,0,0,0.5);
    margin: 2px;
    text-align: center;
    right: 0px;
    top: 0px;
}
#c-comments .post-preview[data-pools^="pool:"] .preview {
    position: relative;
}

To change the data being tested, just adjust the selector between the square brackets "[ ]". Many of the other stylings can also be freely adjusted, such as content and color.

Edit:

(2017-05-25) Adjusted the above so that it appears in the upper right-hand corner, which avoids some slight issues it had overlapping with the animation icon.
(2017-05-27) Fixed issue with how the overlay icon was appearing on the comments page.

Updated

Does anyone know how to change the colors of the tag-count gradient in the tag list? I am using Darkbooru from topic #9588, and the white plus gray color of the gradient makes it rather hard to see. It has been pointed out in the said forum that Gollgagh haven't figured it out yet, but that was three years ago, maybe now someone knows.
I tried to figure it out through googling and inspecting the elements, but I do not know CSS...(I just copypaste CSS codes here and there)

It's not possible to replicate the gradient effect, however if you just want to make the color solid, that's doable.

table.striped td, table.striped th {
    background: darkgrey;
}

Replace the value of darkgrey with whatever you want, to include 4-bit or 8-bit RGB values, e.g. #DDD (4-bit) or #FF0F3F (8-bit).

In-depth

See the problem there is that particular element uses a linear-gradient() function, the arguments for which are generated logarithmically in Ruby from the tag count: the top tag, 1girl with a 100% gradient and 1.8M posts to its name, down to any empty tag with 0% gradient.

The solution will probably require a script, as (afaik) I can't get the tag count to do anything useful with in pure CSS.

Edit: I fixed my style so that it just clobbers the gradient.

I was previously using the .even and .odd classes to style for table striping, but I guess I needed to specify td

Updated

.odd td {
    background-color: #1b1b1b !important;
}
.even td {
    background-color: #282828 !important;
}
.even:hover td, .odd:hover td {
    background-color: #444 !important;
}
table.striped td, table.striped th {
    background-blend-mode: multiply;
}

This will blend your background-color and the linear-gradient to give the effect back.
For browsers that support it, that is.

Updated

I didn't really care for the visual effect, personally; it was the fact that it was based on the tag count which was the interesting part.

Since the data-is-favorited attribute has been added, it is now possible to add effects to images you have favorited.

The following causes favorited images to be faded, and normal when hovering over. (Credit to reiyasona for this visualization idea)

.post-preview[data-is-favorited="true"] {
    opacity: 0.5;
}

.post-preview[data-is-favorited="true"]:hover {
    opacity: 1.0;
}
Edit:

Updated

BrokenEagle98 said:

Since the data-is-favorited attribute has been added, it is now possible to add effects to images you have favorited.

The following causes favorited images to be faded, and normal when hovering over. (Credit to reiyasona for this visualization idea)

[data-is-favorited="true"] img {
    opacity: 0.5;
}

[data-is-favorited="true"] img:hover {
    opacity: 1.0;
}

I tweaked your CSS code a little bit so that it only affects post previews instead of all images.

article.post-preview[data-is-favorited="true"] {
	opacity: 0.15;
}

article.post-preview[data-is-favorited="true"]:hover {
	opacity: 1.0;
}

Ah, good catch. I updated my post.

However, I still left the <article> element out of mine, as that excludes post previews that are in <div> elements, such as those found on the /comments page.

See topic #14113 for the full discussion. Basically though, blacklisted items will appear momentarily as the page loads before the Javascript can hide them. The following CSS codes fixes that and prevents them from displaying at all.

  • NOTE:
    • Javascript must be working or the posts will remain hidden.
/*Blacklist thumbnails hidden (Common case)*/
.post-preview.blacklisted.blacklisted-active {display: none;}
.post-preview.blacklisted {display: inline-block;}
.post-preview {display: none;}

/*Blacklist image hidden*/
.image-container.blacklisted.blacklisted-active {display: none;}
.image-container.blacklisted {display: inline-block;}
.image-container {display: none;}

/*Unique pages*/
#c-comments #a-index .post-preview.blacklisted:not(.blacklisted-active) {display: flex;}

/*Images added after blacklist has been processed*/
#recommended .post-preview {display: inline-block;}
.post-tooltip-body  .post-preview {display: inline-block;}

/*Pages without blacklist controls*/
#c-uploads #a-new .post-preview {display: inline-block;}
#c-iqdb-queries .post-preview {display: inline-block;}

Userscripts

The following userscripts are also affected and need CSS:

Edit:

Updated

Nothing ground breaking about the following CSS, but it does remove the ominous feeling I get whenever I see that huge "Delete account" link...

#delete-account {
    display: none;
}