GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Notices by miunau (miunau@meow.social)

  1. Embed this notice
    miunau (miunau@meow.social)'s status on Tuesday, 13-Feb-2024 02:27:05 JST miunau miunau
    • Mia (web luddite)

    Figured out how to color text black or white depending on background lightness without breaking the components down to HSL in #css

    Edit: this is now a blog post! https://miunau.com/posts/dynamic-text-contrast-in-css/

    Quick and dirty filter stacking

    Assuming --bgColor contains your background color:

    span {
    color: var(--bgColor);
    filter: invert(1) grayscale(1) brightness(1.3) contrast(9000);
    mix-blend-mode: luminosity;
    opacity: 0.95;
    }

    This will turn to black around #AAAAAA. adjust brightness lower if you want it to turn to black earlier. play around with contrast as well, using low and high values.

    After playing around with this (thanks @mia), we noticed there's some fringes happening at certain color values right when it is about to switch from black to white, so this might work best with colors that you get to control to some degree.

    Less fringing with SVG filters

    But! Here is a version that has no fringing:

    Add this somewhere in your markup- it can be anywhere as long as the id bwFilter can be referenced.


    <svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="0">
    <defs>
    <filter id="bwFilter" color-interpolation-filters="sRGB">
    <!-- Convert to grayscale based on luminance -->
    <feColorMatrix type="matrix"
    values="0.2126 0.7152 0.0722 0 0
    0.2126 0.7152 0.0722 0 0
    0.2126 0.7152 0.0722 0 0
    0 0 0 1 0"/>
    <!-- Expand edges slightly to clean up any fringing -->
    <feMorphology operator="dilate" radius="2"/>
    <!-- Apply the threshold to determine if the color should be black or white -->
    <feComponentTransfer>
    <feFuncR type="linear" slope="-255" intercept="128"/>
    <feFuncG type="linear" slope="-255" intercept="128"/>
    <feFuncB type="linear" slope="-255" intercept="128"/>
    </feComponentTransfer>
    <!-- Composite step to clean up the result -->
    <feComposite operator="in" in2="SourceGraphic"/>
    </filter>
    </defs>
    </svg>

    Then just reference it in your css:

    span {
    color: var(--bgColor);
    filter: url(#bwFilter);
    }

    tada! no fringing!

    svg version here: https://codepen.io/miunau/pen/oNVaJoN?editors=1100

    In conversation about a year ago from meow.social permalink

    Attachments

    1. No result found on File_thumbnail lookup.
      SVG namespace

    2. https://medias.meow.social/media_attachments/files/111/912/417/464/851/955/original/b8815fa58c69555a.png


  2. Embed this notice
    miunau (miunau@meow.social)'s status on Sunday, 21-Jan-2024 20:15:24 JST miunau miunau
    in reply to
    • Kevin Beaumont

    @GossiTheDog but who spelled it "producation"

    In conversation Sunday, 21-Jan-2024 20:15:24 JST from meow.social permalink
  3. Embed this notice
    miunau (miunau@meow.social)'s status on Friday, 01-Dec-2023 00:54:43 JST miunau miunau
    in reply to
    • SuperDicq

    @SuperDicq @loup yeah the ones i've used want you to load an external stylesheet which gives the font faces. they have overage fees and stuff

    i use these for work, the designs call for specific typefaces

    In conversation Friday, 01-Dec-2023 00:54:43 JST from meow.social permalink
  4. Embed this notice
    miunau (miunau@meow.social)'s status on Friday, 01-Dec-2023 00:51:49 JST miunau miunau
    in reply to
    • SuperDicq

    @SuperDicq @loup well it suits their wallet

    In conversation Friday, 01-Dec-2023 00:51:49 JST from meow.social permalink
  5. Embed this notice
    miunau (miunau@meow.social)'s status on Friday, 01-Dec-2023 00:48:01 JST miunau miunau
    in reply to
    • SuperDicq

    @SuperDicq @loup most of the foundries price their stuff based on pageload. which suits single page apps i guess? i'd just prefer to give them a grand or something and have the fonts myself

    In conversation Friday, 01-Dec-2023 00:48:01 JST from meow.social permalink
  6. Embed this notice
    miunau (miunau@meow.social)'s status on Friday, 01-Dec-2023 00:43:37 JST miunau miunau

    @loup monotype's licensing sucks though. it's really unworkable for web

    In conversation Friday, 01-Dec-2023 00:43:37 JST from meow.social permalink
  7. Embed this notice
    miunau (miunau@meow.social)'s status on Friday, 01-Dec-2023 00:43:36 JST miunau miunau
    in reply to

    @loup 50% off!!!

    In conversation Friday, 01-Dec-2023 00:43:36 JST from gnusocial.jp permalink

    Attachments


    1. https://medias.meow.social/media_attachments/files/111/500/259/332/706/518/original/b5996544463d3117.png

User actions

    miunau

    miunau

    I make music and music accessories! (he/him) 🏳️🌈Projects:https://LUFS.org - Loudness analyser (+ lots more) in your browser.https://wtsoelay.com - A small DIY label for ambient music.https://QRDate.org - A trusted timestamp that you can physically include in photos, videos and live streams using QR codes and audible data signals.Plugins:https://miunau.com/OTTERDRIVE2/ - An experimental distortion plugin (VST - Mac/Win/Linux)(more on my website)

    Tags
    • (None)

    Following 0

      Followers 0

        Groups 0

          Statistics

          User ID
          218924
          Member since
          30 Nov 2023
          Notices
          7
          Daily average
          0

          Feeds

          • Atom
          • Help
          • About
          • FAQ
          • TOS
          • Privacy
          • Source
          • Version
          • Contact

          GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

          Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.