The new Disney Plus logo is distinctly underwhelming

Original Source: https://www.creativebloq.com/news/disney-plus-logo-change

Bring back Disney castle blue and white!

Artist Craig Yoe returns to underground comix after 50 years for a 'deeply personal look at art and life's lunacy'

Original Source: https://www.creativebloq.com/news/craig-yoe-comix-return

The former Jim Henson and Muppets creative director is launching a new indie comic.

Setting And Persisting Color Scheme Preferences With CSS And A “Touch” Of JavaScript

Original Source: https://smashingmagazine.com/2024/03/setting-persisting-color-scheme-preferences-css-javascript/

Many modern websites give users the power to set a site-specific color scheme preference. A basic implementation is straightforward with JavaScript: listen for when a user changes a checkbox or clicks a button, toggle a class (or attribute) on the <body> element in response, and write the styles for that class to override design with a different color scheme.

CSS’s new :has() pseudo-class, supported by major browsers since December 2023, opens many doors for front-end developers. I’m especially excited about leveraging it to modify UI in response to user interaction without JavaScript. Where previously we have used JavaScript to toggle classes or attributes (or to set styles directly), we can now pair :has() selectors with HTML’s native interactive elements.

Supporting a color scheme preference, like “Dark Mode,” is a great use case. We can use a <select> element anywhere that toggles color schemes based on the selected <option> — no JavaScript needed, save for a sprinkle to save the user’s choice, which we’ll get to further in.

Respecting System Preferences

First, we’ll support a user’s system-wide color scheme preferences by adopting a “Light Mode”-first approach. In other words, we start with a light color scheme by default and swap it out for a dark color scheme for users who prefer it.

The prefers-color-scheme media feature detects the user’s system preference. Wrap “dark” styles in a prefers-color-scheme: dark media query.

selector {
/* light styles */

@media (prefers-color-scheme: dark) {
/* dark styles */
}
}

Next, set the color-scheme property to match the preferred color scheme. Setting color-scheme: dark switches the browser into its built-in dark mode, which includes a black default background, white default text, “dark” styles for scrollbars, and other elements that are difficult to target with CSS, and more. I’m using CSS variables to hint that the value is dynamic — and because I like the browser developer tools experience — but plain color-scheme: light and color-scheme: dark would work fine.

:root {
/* light styles here */
color-scheme: var(–color-scheme, light);

/* system preference is “dark” */
@media (prefers-color-scheme: dark) {
–color-scheme: dark;
/* any additional dark styles here */
}
}

Giving Users Control

Now, to support overriding the system preference, let users choose between light (default) and dark color schemes at the page level.

HTML has native elements for handling user interactions. Using one of those controls, rather than, say, a <div> nest, improves the chances that assistive tech users will have a good experience. I’ll use a <select> menu with options for “system,” “light,” and “dark.” A group of <input type=”radio”> would work, too, if you wanted the options right on the surface instead of a dropdown menu.

<select id=”color-scheme”>
<option value=”system” selected>System</option>
<option value=”light”>Light</option>
<option value=”dark”>Dark</option>
</select>

Before CSS gained :has(), responding to the user’s selected <option> required JavaScript, for example, setting an event listener on the <select> to toggle a class or attribute on <html> or <body>.

But now that we have :has(), we can now do this with CSS alone! You’ll save spending any of your performance budget on a dark mode script, plus the control will work even for users who have disabled JavaScript. And any “no-JS” folks on the project will be satisfied.

What we need is a selector that applies to the page when it :has() a select menu with a particular [value]:checked. Let’s translate that into CSS:

:root:has(select option[value=”dark”]:checked)

We’re defaulting to a light color scheme, so it’s enough to account for two possible dark color scheme scenarios:

The page-level color preference is “system,” and the system-level preference is “dark.”
The page-level color preference is “dark”.

The first one is a page-preference-aware iteration of our prefers-color-scheme: dark case. A “dark” system-level preference is no longer enough to warrant dark styles; we need a “dark” system-level preference and a “follow the system-level preference” at the page-level preference. We’ll wrap the prefers-color-scheme media query dark scheme styles with the :has() selector we just wrote:

:root {
/* light styles here */
color-scheme: var(–color-scheme, light);

/* page preference is “system”, and system preference is “dark” */
@media (prefers-color-scheme: dark) {
&:has(#color-scheme option[value=”system”]:checked) {
–color-scheme: dark;
/* any additional dark styles, again */
}
}
}

Notice that I’m using CSS Nesting in that last snippet. Baseline 2023 has it pegged as “Newly available across major browsers” which means support is good, but at the time of writing, support on Android browsers not included in Baseline’s core browser set is limited. You can get the same result without nesting.

:root {
/* light styles */
color-scheme: var(–color-scheme, light);

/* page preference is “dark” */
&:has(#color-scheme option[value=”dark”]:checked) {
–color-scheme: dark;
/* any additional dark styles */
}
}

For the second dark mode scenario, we’ll use nearly the exact same :has() selector as we did for the first scenario, this time checking whether the “dark” option — rather than the “system” option — is selected:

:root {
/* light styles */
color-scheme: var(–color-scheme, light);

/* page preference is “dark” */
&:has(#color-scheme option[value=”dark”]:checked) {
–color-scheme: dark;
/* any additional dark styles */
}

/* page preference is “system”, and system preference is “dark” */
@media (prefers-color-scheme: dark) {
&:has(#color-scheme option[value=”system”]:checked) {
–color-scheme: dark;
/* any additional dark styles, again */
}
}
}

Now the page’s styles respond to both changes in users’ system settings and user interaction with the page’s color preference UI — all with CSS!

But the colors change instantly. Let’s smooth the transition.

Respecting Motion Preferences

Instantaneous style changes can feel inelegant in some cases, and this is one of them. So, let’s apply a CSS transition on the :root to “ease” the switch between color schemes. (Transition styles at the :root will cascade down to the rest of the page, which may necessitate adding transition: none or other transition overrides.)

Note that the CSS color-scheme property does not support transitions.

:root {
transition-duration: 200ms;
transition-property: /* properties changed by your light/dark styles */;
}

Not all users will consider the addition of a transition a welcome improvement. Querying the prefers-reduced-motion media feature allows us to account for a user’s motion preferences. If the value is set to reduce, then we remove the transition-duration to eliminate unwanted motion.

:root {
transition-duration: 200ms;
transition-property: /* properties changed by your light/dark styles */;

@media screen and (prefers-reduced-motion: reduce) {
transition-duration: none;
}
}

Transitions can also produce poor user experiences on devices that render changes slowly, for example, ones with e-ink screens. We can extend our “no motion condition” media query to account for that with the update media feature. If its value is slow, then we remove the transition-duration.

:root {
transition-duration: 200ms;
transition-property: /* properties changed by your light/dark styles */;

@media screen and (prefers-reduced-motion: reduce), (update: slow) {
transition-duration: 0s;
}
}

Let’s try out what we have so far in the following demo. Notice that, to work around color-scheme’s lack of transition support, I’ve explicitly styled the properties that should transition during theme changes.

See the Pen CSS-only theme switcher (requires :has()) [forked] by Henry.

Not bad! But what happens if the user refreshes the pages or navigates to another page? The reload effectively wipes out the user’s form selection, forcing the user to re-make the selection. That may be acceptable in some contexts, but it’s likely to go against user expectations. Let’s bring in JavaScript for a touch of progressive enhancement in the form of…

Persistence

Here’s a vanilla JavaScript implementation. It’s a naive starting point — the functions and variables aren’t encapsulated but are instead properties on window. You’ll want to adapt this in a way that fits your site’s conventions, framework, library, and so on.

When the user changes the color scheme from the <select> menu, we’ll store the selected <option> value in a new localStorage item called “preferredColorScheme”. On subsequent page loads, we’ll check localStorage for the “preferredColorScheme” item. If it exists, and if its value corresponds to one of the form control options, we restore the user’s preference by programmatically updating the menu selection.

/*
* If a color scheme preference was previously stored,
* select the corresponding option in the color scheme preference UI
* unless it is already selected.
*/
function restoreColorSchemePreference() {
const colorScheme = localStorage.getItem(colorSchemeStorageItemName);

if (!colorScheme) {
// There is no stored preference to restore
return;
}

const option = colorSchemeSelectorEl.querySelector([value=${colorScheme}]);
if (!option) {
// The stored preference has no corresponding option in the UI.
localStorage.removeItem(colorSchemeStorageItemName);
return;
}

if (option.selected) {
// The stored preference’s corresponding menu option is already selected
return;
}

option.selected = true;
}

/*
* Store an event target’s value in localStorage under colorSchemeStorageItemName
*/
function storeColorSchemePreference({ target }) {
const colorScheme = target.querySelector(“:checked”).value;
localStorage.setItem(colorSchemeStorageItemName, colorScheme);
}

// The name under which the user’s color scheme preference will be stored.
const colorSchemeStorageItemName = “preferredColorScheme”;

// The color scheme preference front-end UI.
const colorSchemeSelectorEl = document.querySelector(“#color-scheme”);

if (colorSchemeSelectorEl) {
restoreColorSchemePreference();

// When the user changes their color scheme preference via the UI,
// store the new preference.
colorSchemeSelectorEl.addEventListener(“input”, storeColorSchemePreference);
}

Let’s try that out. Open this demo (perhaps in a new window), use the menu to change the color scheme, and then refresh the page to see your preference persist:

See the Pen CSS-only theme switcher (requires :has()) with JS persistence [forked] by Henry.

If your system color scheme preference is “light” and you set the demo’s color scheme to “dark,” you may get the light mode styles for a moment immediately after reloading the page before the dark mode styles kick in. That’s because CodePen loads its own JavaScript before the demo’s scripts. That is out of my control, but you can take care to improve this persistence on your projects.

Persistence Performance Considerations

Where things can get tricky is restoring the user’s preference immediately after the page loads. If the color scheme preference in localStorage is different from the user’s system-level color scheme preference, it’s possible the user will see the system preference color scheme before the page-level preference is restored. (Users who have selected the “System” option will never get that flash; neither will those whose system settings match their selected option in the form control.)

If your implementation is showing a “flash of inaccurate color theme”, where is the problem happening? Generally speaking, the earlier the scripts appear on the page, the lower the risk. The “best option” for you will depend on your specific stack, of course.

What About Browsers That Don’t Support :has()?

All major browsers support :has() today Lean into modern platforms if you can. But if you do need to consider legacy browsers, like Internet Explorer, there are two directions you can go: either hide or remove the color scheme picker for those browsers or make heavier use of JavaScript.

If you consider color scheme support itself a progressive enhancement, you can entirely hide the selection UI in browsers that don’t support :has():

@supports not selector(:has(body)) {
@media (prefers-color-scheme: dark) {
:root {
/* dark styles here */
}
}

#color-scheme {
display: none;
}
}

Otherwise, you’ll need to rely on a JavaScript solution not only for persistence but for the core functionality. Go back to that traditional event listener toggling a class or attribute.

The CSS-Tricks “Complete Guide to Dark Mode” details several alternative approaches that you might consider as well when working on the legacy side of things.

UI Interactions & Animations Roundup #41

Original Source: https://tympanus.net/codrops/2024/03/22/ui-interactions-animations-roundup-41/

Discover a new collection of user interface animations and interactive designs to spark your creativity.

Writing With Purpose Engage, Persuade, and Grow Your Customer Base

Original Source: https://www.hongkiat.com/blog/build-customers-from-strangers/

Seems like a tall order, but fostering a bond with readers in just one post is all in a day’s work for a skilled freelance content writer. Our mission, ambitious as it may appear, is to grab a stranger’s attention and nurture that connection, turning them into a friend, a keen learner, an admirer, a student, a patron, or perhaps a mix of these roles.

For many budding writers diving into freelance writing, the big question is “How?” How do we craft content that can transform readers in ways they never imagined possible within a mere 1000 words? Step one: captivate them from the get-go.

First Impressions Matter

“…said the spider to the fly.” The challenge of grabbing someone’s attention and keeping them engaged long enough to click through is arguably the toughest hurdle in freelance writing.

Why? Because you’re often working with just 12 words or 70 characters. Go beyond, and search engines might bury your content. Visibility is key, and that starts with making a strong first impression.

10 SEO Mistakes All Bloggers Should Avoid

.no-js #ref-block-post-11208 .ref-block__thumbnail { background-image: url(“https://assets.hongkiat.com/uploads/thumbs/250×160/seo-mistakes-bloggers-should-avoid.jpg”); }

10 SEO Mistakes All Bloggers Should Avoid

Search engine optimization (SEO) is vital to any successful blogging campaign. Therefore it should be implemented in the… Read more

Creating Captivating Titles and Intros

Search engine results display just the first 70 characters of your title. Though the entire title is indexed, even if it spans 1000 characters, only the initial 70 make it to the preview. It’s crucial, then, to make your point clear within this limited space.

Secrets Of A Killer Blog Post [Infographic]

.no-js #ref-block-post-19408 .ref-block__thumbnail { background-image: url(“https://assets.hongkiat.com/uploads/thumbs/250×160/infographic-writing-killer-post.jpg”); }

Secrets Of A Killer Blog Post [Infographic]

One of the hardest bit about maintaining a blog is to stand out of the crowded blogging landscape,… Read more

Positioning your main keyword at the start of the title boosts its ranking, assuming your content is SEO-optimized. Early keyword placement is key.

A title that manages to rank well must be engaging, clear, and compelling to ensure the searcher’s attention is captured. Incorporating the search term early not only helps in drawing them in but also in keeping them engaged.

Establishing Immediate Rapport

Having caught your reader’s attention, the next step is to quickly build a connection. It’s essential for readers to feel at ease with your voice and style. Often writing on behalf of others, freelancers must convey authenticity as if they’re sharing their own insights.

Key to this is confidence and clarity. Your writing should communicate not just as a content creator, but as the authority on the subject matter, offering knowledge and reliability.

7 Ways to Keep Your Online Audience Reading

.no-js #ref-block-post-16218 .ref-block__thumbnail { background-image: url(“https://assets.hongkiat.com/uploads/thumbs/250×160/keep-audience-reading.jpg”); }

7 Ways to Keep Your Online Audience Reading

Master web writing and boost audience reading with our with these tips. Making online content creation easy for… Read more

Sparking Interest with Trends

Even when topics aren’t inherently captivating, it’s your challenge to discover and highlight their trendy aspects. Excelling as a writer means being adept at presenting any subject in an engaging light, finding the angle that resonates with public interest.

The trick lies in viewing the topic from various perspectives and identifying what the audience finds valuable. Once the appeal is clear, illustrating its benefits and solutions becomes straightforward, making even the most mundane topics intriguing.

6 Simple Tips To Write Your Next Killer Post

.no-js #ref-block-post-18410 .ref-block__thumbnail { background-image: url(“https://assets.hongkiat.com/uploads/thumbs/250×160/simple-writing-tips.jpg”); }

6 Simple Tips To Write Your Next Killer Post

I’m not surprised to find out that people are reading less. There is so much more happening elsewhere,… Read more

Cultivating Trust Through Confidence

Writing confidently is crucial for fostering trust between you and readers seeking guidance. Solid research backs up the freelance writer’s ability to add value, ensuring that the audience gains from their visit to your site or blog.

The foundation of trust is laid in the very first paragraph. After drawing the reader in with a compelling title, the opening sentences must be informative and robust enough to retain their attention. This is your chance to make a bold promise about the value your article will deliver, establishing a relationship of trust from the outset.

Building Credibility with Depth

Detailed research is vital for reinforcing trust by establishing your credibility. Offering unique, interesting facts that readers won’t find just anywhere elevates your status as an expert. It’s about providing that extra something that they can’t get from anyone else.

Uncovering those unique, verifiable insights and backing them up with reputable sources shows your readers they need not only the product or service you’re writing about but also your guidance and expertise.

Embracing Flexibility in Your Writing

The secret to authoritative writing is knowing how to flexibly apply writing rules without compromising their integrity. This is where your unique voice shines through, transforming standard information into engaging narratives. It’s about adding personality to your prose, making it resonate as though you’re conversing with the reader directly.

By skillfully bending the rules without breaking them, you cultivate a style that’s both informative and engaging, akin to advice from a knowledgeable friend. This approach not only enriches your content but also makes it more relatable and trustworthy to your audience.

Unleashing Your Creative License

Creative license isn’t about distorting facts but about presenting them through your unique lens. It’s an honest interpretation, your take on truths laid out by others, crafted into a narrative that speaks directly to your readers.

This personalized storytelling makes each piece feel like a one-on-one conversation, a letter to a cherished friend. It’s this use of creative freedom that readers adore, drawing them closer to your content and perspective.

Concluding with Impact: Your Call to Action

Mastery of the call to action is a craft honed over years, essential for transitioning smoothly from trusted authority to persuasive advocate. The art lies in weaving this call seamlessly into your narrative, maintaining the authentic voice that has guided the reader thus far.

Abrupt shifts in tone risk alienating your audience, undoing the rapport you’ve built. Thus, every piece of advice, every trend highlighted, and every fact shared culminates in a call to action that resonates with sincerity and confidence, echoing the trustworthiness of the entire piece.

Are You Ready to Make a Difference?

Armed with insights into content creation, do you feel equipped to build your own loyal readership? This journey demands confidence, authority, and a genuine connection with your subject matter, underpinned by thorough research.

If you embrace these principles, readers will come to see you as the go-to expert in your field, eagerly anticipating your take on topics within your niche. Now, step forward with confidence and start forging those vital connections.

The post Writing With Purpose Engage, Persuade, and Grow Your Customer Base appeared first on Hongkiat.

Creating an Interactive 3D Bulge Text Effect with React Three Fiber

Original Source: https://tympanus.net/codrops/2024/03/20/creating-an-interactive-3d-bulge-text-effect-with-react-three-fiber/

Exploring how to generate an engaging bulge effect on text using React Three Fiber.

Build a Full-stack App with Node.js and htmx

Original Source: https://www.sitepoint.com/node-js-htmx-build-full-stack-app/?utm_source=rss

Build a Full-stack App with Node.js and htmx

Learn how to craft a full-stack CRUD application using Node and Express for the backend and htmx for the frontend.

Continue reading
Build a Full-stack App with Node.js and htmx
on SitePoint.

The Poohniverse: Monsters Assemble poster has ruined my childhood (but I think I love it)

Original Source: https://www.creativebloq.com/news/poohniverse-monsters-assemble

Watch out Marvel.

Inspirational Websites Roundup #57

Original Source: https://tympanus.net/codrops/2024/03/15/inspirational-websites-roundup-57/

Discover a fresh collection of websites, each chosen for their outstanding design, to spark your inspiration.