Skip Navigation

PieFed CSS

Members
0
Posts
29
Created
1 yr. ago

nightash metal: A Return to Skeuomorphism with a Metallic-Like Surface

A minimalistic skeumorphic theme for PieFed.zip that I made.

 
/* nightash metal for PieFed's Additional CSS field. */  
:root {  
  --nm-canvas: #dad9d5;  
  --nm-paper: #faf7ef;  
  --nm-field: #fffdf7;  
  --nm-ink: #292925;  
  --nm-muted: #585b5e;  
  --nm-link: #245678;  
  --nm-hover: #193e59;  
  --nm-edge: #a5a7a6;  
  --nm-rule: #d2cec3;  
  --nm-metal-light: #eeeef0;  
  --nm-metal-dark: #cfd1d2;  
  --nm-inset: #bec4c8;  
  --nm-highlight: #ffffffbd;  
  --nm-shadow: #252a322e;  
}  

:root[data-bs-theme="dark"], :root:has(body[data-bs-theme="dark"]) {  
  --nm-canvas: #202224;  
  --nm-paper: #2e2c28;  
  --nm-field: #24231f;  
  --nm-ink: #f0eae0;  
  --nm-muted: #c1bdb4;  
  --nm-link: #a7cde8;  
  --nm-hover: #d3eaff;  
  --nm-edge: #71767a;  
  --nm-rule: #55534c;  
  --nm-metal-light: #454a4f;  
  --nm-metal-dark: #34383c;  
  --nm-inset: #25292d;  
  --nm-highlight: #ffffff28;  
  --nm-shadow: #0007;  
}  

@media (prefers-color-scheme: dark) {  
  :root:not([data-bs-theme="light"]):not(:has(body[data-bs-theme="light"])) {  
    --nm-canvas: #202224;  
    --nm-paper: #2e2c28;  
    --nm-field: #24231f;  
    --nm-ink: #f0eae0;  
    --nm-muted: #c1bdb4;  
    --nm-link: #a7cde8;  
    --nm-hover: #d3eaff;  
    --nm-edge: #71767a;  
    --nm-rule: #55534c;  
    --nm-metal-light: #454a4f;  
    --nm-metal-dark: #34383c;  
    --nm-inset: #25292d;  
    --nm-highlight: #ffffff28;  
    --nm-shadow: #0007;  
  }  
}  

body {  
  --nm-action-size: 1.75rem;  
  --nm-satin: linear-gradient(var(--nm-metal-light), var(--nm-metal-dark));  
  --nm-satin-hover: linear-gradient(  
    color-mix(in srgb, var(--nm-metal-light), var(--nm-link) 8%),  
    color-mix(in srgb, var(--nm-metal-dark), var(--nm-link) 18%)  
  );  
  --nm-blue-inset: color-mix(in srgb, var(--nm-inset), var(--nm-link) 22%);  
  --bs-body-bg: var(--nm-canvas);  
  --bs-body-color: var(--nm-ink);  
  --bs-emphasis-color: var(--nm-ink);  
  --bs-secondary-color: var(--nm-muted);  
  --bs-secondary-bg: var(--nm-metal-dark);  
  --bs-tertiary-bg: var(--nm-paper);  
  --bs-border-color: var(--nm-rule);  
  background-color: var(--nm-canvas);  
  color: var(--nm-ink);  
  font-family: "Segoe UI", system-ui, sans-serif;  
}  

body a:is(.post_teaser_title_a, .post_title, .post_title a, :is(.post_body, .comment_body, .comment_content, .e-content) :is(p, li) a):not(.btn, .badge, .dropdown-item, .nav-link, [role="button"]) {  
  color: var(--nm-reading-link, var(--nm-link));  
  text-underline-offset: .16em;  
}  

body a:hover { --nm-reading-link: var(--nm-hover); }  

body :focus-visible {  
  outline: 2px solid var(--nm-link);  
  outline-offset: 2px;  
}  

body .navbar,  
body .card-header,  
body .card-footer {  
  background: linear-gradient(var(--nm-metal-light), var(--nm-metal-dark));  
  color: var(--nm-ink);  
  border-color: var(--nm-edge);  
  box-shadow: inset 0 1px var(--nm-highlight);  
}  

body .navbar {  
  --bs-navbar-color: var(--nm-ink);  
  --bs-navbar-hover-color: var(--nm-hover);  
  --bs-navbar-active-color: var(--nm-ink);  
  border-block-end: 1px solid var(--nm-edge);  
}  

body .navbar .navbar-brand {  
  color: var(--nm-ink);  
  font-weight: 700;  
  letter-spacing: -.025em;  
}  

body .navbar .navbar-nav { gap: .25rem; }  

body .navbar :is(.nav-link, .btn-link, .navbar-toggler):not(.navbar-brand, .dropdown-item) {  
  color: var(--nm-ink);  
  background: var(--nm-satin);  
  border: 1px solid var(--nm-edge);  
  border-radius: 4px;  
  box-shadow: inset 0 1px var(--nm-highlight), 0 1px 2px var(--nm-shadow);  
  text-decoration: none;  
}  

body .navbar :is(.nav-link, .btn-link, .navbar-toggler):not(.navbar-brand, .dropdown-item):is(:hover, :focus-visible) {  
  background: var(--nm-satin-hover);  
  border-color: var(--nm-link);  
}  

body .navbar :is(.nav-link, .btn-link, .navbar-toggler):not(.navbar-brand, .dropdown-item):is(:active, .active, .show, [aria-current="page"], [aria-pressed="true"], [aria-expanded="true"]),  
body .nav-pills .nav-link.active,  
body .page-item.active .page-link {  
  color: var(--nm-ink);  
  background: var(--nm-blue-inset);  
  border-color: var(--nm-edge);  
  box-shadow: inset 0 1px 3px var(--nm-shadow), 0 1px var(--nm-highlight);  
}  

body .card,  
body .list-group-item,  
body .modal-content,  
body .dropdown-menu,  
body .offcanvas {  
  background-color: var(--nm-paper);  
  color: var(--nm-ink);  
  border-color: var(--nm-edge);  
  border-radius: 5px;  
}  

body .dropdown-menu {  
  --bs-dropdown-link-color: var(--nm-ink);  
  --bs-dropdown-link-hover-color: var(--nm-ink);  
  --bs-dropdown-link-hover-bg: var(--nm-metal-light);  
  --bs-dropdown-link-active-color: var(--nm-ink);  
  --bs-dropdown-link-active-bg: var(--nm-blue-inset);  
}  

body :is(.post_listing, .post_teaser, .post_full, .comment) {  
  background-color: var(--nm-paper);  
  color: var(--nm-ink);  
  border-color: var(--nm-rule);  
}  

body :is(.post_listing, .post_teaser) {  
  border-block-end: 1px solid var(--nm-rule);  
}  

body :is(.post_body, .comment_body, .comment_content) {  
  max-inline-size: 74ch;  
  line-height: 1.65;  
  overflow-wrap: anywhere;  
}  

body :is(.comment_list, .comment) .comment {  
  border-inline-start: 1px solid var(--nm-edge);  
  padding-inline-start: clamp(.35rem, 1vw, .75rem);  
}  

body .comment:target { border-inline-start-color: var(--nm-link); }  
body :is(.post_meta, .comment_meta, .text-muted) { color: var(--nm-muted); }  

body :is(.form-control, .form-select) {  
  color: var(--nm-ink);  
  background-color: var(--nm-field);  
  border-color: var(--nm-edge);  
  border-radius: 4px;  
  box-shadow: inset 0 1px 3px var(--nm-shadow);  
}  

body :is(.form-control, .form-select):focus {  
  color: var(--nm-ink);  
  background-color: var(--nm-field);  
  border-color: var(--nm-link);  
  box-shadow: inset 0 1px 3px var(--nm-shadow), 0 0 0 1px var(--nm-link);  
}  

body .form-control::placeholder { color: var(--nm-muted); }  
body textarea.form-control { resize: vertical; }  

/* PieFed's DownArea Markdown editor. */  
body .downarea {  
  --nm-editor-seam: color-mix(in srgb, var(--nm-edge), var(--nm-ink) 20%);  
  background: var(--nm-paper);  
  border: 1px solid var(--nm-editor-seam);  
  border-radius: 6px;  
  box-shadow: 0 2px 5px var(--nm-shadow);  
}  

body .downarea:is(.focused, :focus-within) {  
  border-color: var(--nm-link);  
  box-shadow: 0 0 0 1px var(--nm-link), 0 2px 5px var(--nm-shadow);  
}  

body .downarea :is(.downarea-toolbar, .downarea-bottom) {  
  background: var(--nm-satin);  
  border-color: var(--nm-editor-seam);  
  box-shadow: inset 0 1px var(--nm-highlight);  
}  

body .downarea .downarea-toolbar { border-radius: 5px 5px 0 0; }  

body .downarea .downarea-bottom {  
  border-block-end: 0;  
  border-radius: 0 0 5px 5px;  
}  

body .downarea .downarea-toolbar-tool {  
  color: var(--nm-ink);  
  background: var(--nm-satin);  
  border-color: var(--nm-edge);  
  border-radius: 4px;  
  box-shadow: inset 0 1px var(--nm-highlight), 0 1px 2px var(--nm-shadow);  
}  

body .downarea .downarea-toolbar-tool:hover {  
  background: var(--nm-satin-hover);  
  border-color: var(--nm-link);  
}  

body .downarea .downarea-toolbar-tool:is(:active, .active, [aria-pressed="true"], [aria-expanded="true"], :has(> .downarea-tool-dropdown.active)) {  
  background: var(--nm-blue-inset);  
  box-shadow: inset 0 2px 4px var(--nm-shadow);  
}  

body .downarea .downarea-toolbar-tool > svg {  
  color: inherit;  
  fill: currentColor;  
  opacity: 1;  
}  

body .downarea .downarea-toolbar-tool:focus-visible {  
  outline: 2px solid var(--nm-link);  
  outline-offset: 1px;  
}  

body .downarea .downarea-textarea textarea {  
  padding: .7rem .8rem;  
  border: 0;  
  border-radius: 0;  
  background: var(--nm-paper);  
  color: var(--nm-ink);  
  line-height: 1.55;  
  resize: none;  
  box-shadow: inset 0 2px 6px var(--nm-shadow);  
}  

body .downarea .downarea-textarea textarea:focus { outline: 0; }  
body .downarea .downarea-textarea textarea::placeholder { color: var(--nm-muted); }  

body :is(.btn, .navbar-toggler, .page-link):not(.btn-link, .btn-close, .btn-danger, .btn-outline-danger) {  
  --bs-btn-color: var(--nm-ink);  
  --bs-btn-hover-color: var(--nm-ink);  
  --bs-btn-active-color: var(--nm-ink);  
  --bs-pagination-color: var(--nm-ink);  
  color: var(--nm-ink);  
  background: linear-gradient(var(--nm-metal-light), var(--nm-metal-dark));  
  border-color: var(--nm-edge);  
  border-radius: 4px;  
  box-shadow: inset 0 1px var(--nm-highlight), 0 1px 1px var(--nm-shadow);  
}  

body :is(.btn, .navbar-toggler, .page-link):not(.btn-link, .btn-close, .btn-danger, .btn-outline-danger):hover {  
  background: var(--nm-satin-hover);  
  border-color: var(--nm-link);  
}  

body :is(.btn, .navbar-toggler, .page-link):not(.btn-link, .btn-close, .btn-danger, .btn-outline-danger):is(:active, [aria-pressed="true"], .active),  
body .page-item.active .page-link {  
  background: var(--nm-blue-inset);  
  box-shadow: inset 0 2px 4px var(--nm-shadow);  
}  

/* Only the clickable element carries the bevel. */  
body :is(.comment_actions, .post_utilities_bar) :is(.emoji_button, .post_replies_link):has(> a) {  
  background: transparent;  
  border-color: transparent;  
  box-shadow: none;  
}  

body :is(  
  .voting_buttons_new > :is(.upvote_button, .downvote_button):is([role="button"], .redirect_login),  
  :is(.comment_actions, .post_utilities_bar) .post_replies_link > a,  
  a.reaction_button[role="button"],  
  .comment_actions .hide_button > a,  
  a.fe:is(.fe-bell, .fe-no-bell)[hx-post],  
  a:is([id^="post_options_link_"], [id^="comment_options_link_"]),  
  #outer_container .share_desktop a  
) {  
  --nm-action-face: var(--nm-satin);  
  --nm-action-shadow: inset 0 1px var(--nm-highlight), 0 1px 2px var(--nm-shadow);  
  display: inline-flex;  
  align-items: center;  
  justify-content: center;  
  align-self: center;  
  flex: none;  
  gap: .125rem;  
  box-sizing: border-box;  
  inline-size: auto;  
  block-size: auto;  
  min-inline-size: var(--nm-action-size);  
  min-block-size: var(--nm-action-size);  
  padding: .125rem .3rem;  
  border: 1px solid var(--nm-edge);  
  border-radius: 4px;  
  background: var(--nm-action-face);  
  box-shadow: var(--nm-action-shadow);  
  color: var(--nm-link);  
  font-size: .875rem;  
  line-height: 1.15;  
  text-decoration: none;  
  vertical-align: middle;  
}  

body :is(  
  .voting_buttons_new > :is(.upvote_button, .downvote_button):is([role="button"], .redirect_login),  
  :is(.comment_actions, .post_utilities_bar) .post_replies_link > a,  
  a.reaction_button[role="button"],  
  .comment_actions .hide_button > a,  
  a.fe:is(.fe-bell, .fe-no-bell)[hx-post],  
  a:is([id^="post_options_link_"], [id^="comment_options_link_"]),  
  #outer_container .share_desktop a  
):hover {  
  --nm-action-face: var(--nm-satin-hover);  
  border-color: var(--nm-link);  
  color: var(--nm-hover);  
}  

body :is(  
  .voting_buttons_new > :is(.upvote_button, .downvote_button):is([role="button"], .redirect_login),  
  :is(.comment_actions, .post_utilities_bar) .post_replies_link > a,  
  a.reaction_button[role="button"],  
  .comment_actions .hide_button > a,  
  a.fe:is(.fe-bell, .fe-no-bell)[hx-post],  
  a:is([id^="post_options_link_"], [id^="comment_options_link_"]),  
  #outer_container .share_desktop a  
):is(:active, .voted_up, .voted_down, [aria-expanded="true"], [aria-pressed="true"]) {  
  --nm-action-face: var(--nm-blue-inset);  
  --nm-action-shadow: inset 0 2px 4px var(--nm-shadow);  
}  

/* PieFed uses a fixed 44px line height on the vote glyph by default. */  
body .voting_buttons_new > :is(.upvote_button, .downvote_button) > .fe {  
  color: inherit;  
  line-height: 1;  
}  

body a.reaction_button[role="button"] > svg.icon {  
  display: block;  
  inline-size: 1em;  
  block-size: 1em;  
  background: none;  
  border: 0;  
  box-shadow: none;  
}  

@media (pointer: coarse) {  
  body { --nm-action-size: 2.75rem; }  
}  

@media (max-width: 767.98px) {  
  body .nav-pills { gap: .25rem; }  
  body .nav-pills .nav-link { padding: .3rem .5rem; }  
}  

1-Click Hide Post in Feed

A simple Tampermonkey script that adds a one-click hide button to posts on piefed.social (main feed). It uses PieFed’s native web route to hide posts and restores the scroll position after the page reloads. Needs: https://www.tampermonkey.net/ This is an independent, unofficial userscript. Made with ChatGPT. My personal motivation for making this: I prefer to use social media with an inbox zero approach. I want to hide everything that I have seen so that in the end my inbox is empty. (Voyager app has a nice swipe mechanism for this, but it doesn't use the hide feature of PieFed but rather remains local.)

 
if (!csrfMeta) {  
  alert("PieFed Hide: CSRF-Token nicht gefunden.");  
  return;  
}  

const form = document.createElement("form");  
form.method = "POST";  
form.action = `/post/${postId}/hide/yes`;  
form.style.display = "none";  

const tokenInput = document.createElement("input");  
tokenInput.type = "hidden";  
tokenInput.name = "csrf_token";  
tokenInput.value = csrfMeta.content;  

form.appendChild(tokenInput);  
document.body.appendChild(form);  

// Aktuelle Scrollposition vor dem Absenden speichern  
sessionStorage.setItem(  
  scrollKey,  
  String(window.scrollY)  
);  

form.submit();  

 
const match = teaser.id.match(/^post_(\d+)$/);  
if (!match) return;  

const optionsLink = teaser.querySelector(  
  ".post_options_link"  
);  
if (!optionsLink) return;  

const wrap = document.createElement("span");  
wrap.style.display = "inline-block";  
wrap.style.marginRight = "4px";  
wrap.title = "Diesen Beitrag vor mir verbergen";  

const link = document.createElement("a");  
link.href = "#";  
link.setAttribute(  
  "aria-label",  
  "Diesen Beitrag vor mir verbergen"  
);  
link.innerHTML =  
  `<span class="fe ${HIDE_ICON_CLASS}"></span>`;  

link.addEventListener("click", function (event) {  
  event.preventDefault();  
  event.stopPropagation();  

  hidePost(match[1]);  
});  

wrap.appendChild(link);  
optionsLink.insertBefore(wrap, optionsLink.firstChild);  

teaser.dataset.oneclickHideAdded = "1";  

Mintager - Custom CSS for PieFed, inspired by the Voyager Mint Color Palette

Hi, I've published all the custom CSS that I use on my PieFed instance. It's inspired by the Mint color palette from Voyager. It's almost a theme, but for now I'll keep it all in custom CSS to keep things simple. It's only optimized for darkmode, for now. If you don't like mint, you can change the main color variable --bs-base-color in line 7 and 17 to a color of your liking. That'll change the base color for everything, except the logo, that's a png from my codeberg repo (corresponding logo code starting at line 108). I tried filtering the original blue PieFed logo to mint with something like filter: hue-rotate(305deg) but it wasn't quite right. You can find the code on codeberg. And you can see a demo running on my instance. Screenshot of the custom CSS applied to my instance cake.kobel.fyi Have a nice day :)

How to hide the emoji "message reactions"?

I'm trying to figure out how to remove the recently added emoji reactions to posts. I don't care about them, and each one moves the next post down a little, wasting screen space. I can do it in ublock origin with the filter: quokk.au##.message_reaction So I tried to modify the CSS from this post's example .fe-warning { display: none; } into .message_reaction { display: none; }. But that doesn't work, and I'm a little lost where to go from here (I don't really know what I'm doing in the first place). Thanks for any help!

Full Title for Tile Layouts

... and vertical vote buttons

 
#masonry {  
  margin-left: -5px;  
  padding-top: 5px;  
}  
#masonry .column {  
  padding-right: 3pt;  
}  
#masonry .item .masonry_info .row .col-8 p * {  
  white-space: normal;  
  line-height: 100%;  
}  
#masonry .item .masonry_info .voting_buttons_masonry {  
  display: block;  
}  
#masonry .item .masonry_info .row .col .upvote_button {  
  display: block;  
  margin: 0 auto  
}  
#masonry .item .masonry_info {  
  position: relative;  
  bottom: inherit;  
}  

Autoplay videos (JavaScript for admins only)

NSFW communities are often a mixture of redgifs videos (which play automatically) and <video> elements linking to mp4s which don't. This script evens the playing field so mp4 videos autoplay as well. Hover your mouse over the video and it'll unmute.

 
document.addEventListener("DOMContentLoaded", () => {  
  const videos = document.querySelectorAll("video");  

  const observer = new IntersectionObserver((entries) => {  
    entries.forEach(entry => {  
      if (entry.isIntersecting) {  
        entry.target.play().catch(err => {  
          console.warn("Autoplay blocked:", err);  
        });  
      } else {  
        entry.target.pause();  
      }  
    });  
  }, { threshold: 0.5 });  

  videos.forEach(video => {  
    video.muted = true; // ensure muted initially  
    observer.observe(video);  

    video.addEventListener("mouseenter", () => {  
      video.muted = false; // unmute on hover  
    });  

    video.addEventListener("mouseleave", () => {  
      video.muted = true; // re-mute when not hovered  
    });  
  });  
});  

Put it into the 'Additional JS' field in /admin/misc.

Lemmy/old Reddit styles

I really like Piefed's pace of development, featureset, and the responsiveness of the dev team, but I find the main UI a little lacking. Thanks to custom CSS I was able to tweak in the following: • Use more screen real estate on larger viewports • Fix height of posts, regardless of whether there's an image/icon or not • Fix size of link images and thumbnails to always be the same • Anchor post options buttons to right and fix their order so you can quickly do a visual scan of replies and votes I'm continually impressed by just how "flex" flexbox really is!

 
/* Use more width in larger viewports */  
.container-lg, .container-xl, .container-xxl {  
  max-width: 90% !important;  
}  

.col.post_teaser_body {  
  display: flex !important;  
  gap: 1rem !important;  
  align-items: flex-start !important;  
}  

/* Image in left column */  
.post_teaser_image_preview, .col_thumbnail {  
  order: -1 !important;  
  flex-shrink: 0 !important;  
  width: 160px !important;  
  height: 80px !important;  
  overflow: hidden !important;  
}  

/* New styles to anchor post_utilities_bar to the right */  
.post_utilities_bar {  
  display: flex !important;  
  flex-shrink: 0 !important;  
  justify-content: flex-end !important;  
  gap: 0 !important;  
  margin-left: auto !important;  
}  

/* Reorder the child elements */  
.cross_post_button { order: 1 !important; }  
.post_replies_link { order: 2 !important; }  
.voting_buttons_new { order: 3 !important; }  
.post_options_link { order: 4 !important; margin-left: auto !important; }  

/* Create a "virtual" right column using flex direction */  
.post_teaser_body > :not(.post_teaser_image_preview) {  
  flex: 1 !important;  
  min-width: 0 !important;  
  display: flex !important;  
  flex-direction: column !important;  
  gap: 0.3rem !important;  
  width: 100% !important;  
}  

/* Ensure the options dropdown stays properly aligned */  
.post_options_link.pull-right {  
  margin-left: 0 !important;  
}