ph

Controlled shape morphing of solvent free thermoresponsive soft actuators

Soft Matter, 2020, 16,4162-4172
DOI: 10.1039/D0SM00020E, Paper
Vadakkumnalath Prakasan Anju, Raghunandan Pratoori, Deepak Kumar Gupta, Rajendra Joshi, Ratna Kumar Annabattula, Pijush Ghosh
Reconfigurable actuators are designed based on chitosan and pNipam which has the capability to attain precise and programmable actuation. The current approach offers a feasible way to fabricate soft actuators with repeatable and reversible actuation.
The content of this RSS Feed (c) The Royal Society of Chemistry




ph

Photo-tunable hydrogel mechanical heterogeneity informed by predictive transport kinetics model

Soft Matter, 2020, 16,4131-4141
DOI: 10.1039/D0SM00052C, Paper
Callie I. Higgins, Jason P. Killgore, Frank W. DelRio, Stephanie J. Bryant, Robert R. McLeod
Photo-tunable hydrogel mechanical heterogeneity using a single resin is presented here, informed by a predictive transport kinetics and swelling model.
The content of this RSS Feed (c) The Royal Society of Chemistry




ph

Lipid-core/polymer-shell hybrid nanoparticles: synthesis and characterization by fluorescence labeling and electrophoresis

Soft Matter, 2020, 16,4173-4181
DOI: 10.1039/D0SM00077A, Paper
Sophie Bou, Xinyue Wang, Nicolas Anton, Redouane Bouchaala, Andrey S. Klymchenko, Mayeul Collot
New hybrid nanoparticles have been obtained by simple nanoprecipitation using fluorescent labeling of both the oily core (BODIPY) and the polymeric shell (rhodamine) thus allowing the use of electrophoresis to assess their formation and stability.
The content of this RSS Feed (c) The Royal Society of Chemistry




ph

High antisite defect concentrations in hard-sphere colloidal Laves phases

Soft Matter, 2020, 16,4155-4161
DOI: 10.1039/D0SM00335B, Paper
Open Access
  This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.
Berend van der Meer, Frank Smallenburg, Marjolein Dijkstra, Laura Filion
We show that the equilibrium Laves phase in binary hard-sphere mixtures contains an extraordinarily high concentration of antisite defects:  we find stable regions where up to 2% of the large-particle lattice sites are occupied by a small particle.
The content of this RSS Feed (c) The Royal Society of Chemistry




ph

Phenylalanine dimer assembly structure as the basic building block of an amyloid like photoluminescent nanofibril network

Soft Matter, 2020, 16,4105-4109
DOI: 10.1039/D0SM00387E, Communication
Prabhjot Singh, Nishima Wangoo, Rohit K. Sharma
Self-assembled phenylalanine dimer as the basic supramolecular structure of β-amyloid like photoluminescent nanofibrils.
The content of this RSS Feed (c) The Royal Society of Chemistry




ph

Rapid analysis of cell-generated forces within a multicellular aggregate using microsphere-based traction force microscopy

Soft Matter, 2020, 16,4192-4199
DOI: 10.1039/C9SM02377A, Paper
Buğra Kaytanlı, Aimal H. Khankhel, Noy Cohen, Megan T. Valentine
We measure cell-generated forces from the deformations of elastic microspheres embedded within multicellular aggregates. Using a computationally efficient analytical model, we directly obtain the full 3D mapping of surface stresses within minutes.
The content of this RSS Feed (c) The Royal Society of Chemistry




ph

Polypyrrole and polyaniline nanocomposites with high photothermal conversion efficiency

Soft Matter, 2020, Advance Article
DOI: 10.1039/D0SM00306A, Communication
Lorena Ruiz-Pérez, Loris Rizzello, Jinping Wang, Nan Li, Giuseppe Battaglia, Yiwen Pei
A simple and scalable synthetic approach to produce functional conducting polymer (CP) nanocomposites using the Fe-complexed PISA-prepared nanoparticles is demonstrated.
To cite this article before page numbers are assigned, use the DOI form of citation above.
The content of this RSS Feed (c) The Royal Society of Chemistry




ph

Saddle-curvature instability of lipid bilayer induced by amphipathicpeptides: A molecular model

Soft Matter, 2020, Accepted Manuscript
DOI: 10.1039/D0SM00499E, Paper
Rachel Downing, Guilherme Volpe Bossa, Sylvio May
Amphipathic peptides that partition into lipid bilayers affect the curvature elastic properties oftheir host. Some of these peptides are able to shift the Gaussian modulus to positive values, thustriggering an...
The content of this RSS Feed (c) The Royal Society of Chemistry




ph

A Companion to Photography


 

The study of photography has never been more important. A look at today's digital world reveals that a greater number of photographs are being taken each day than at any other moment in history. Countless photographs are disseminated instantly online and more and more photographic images are earning prominent positions—and garnering record prices—in the rarefied realm of top art galleries.

Reflecting this dramatic increase in all things photographic



Read More...




ph

Entrepreneurial trees, watered by philanthropy, bears fruit


the Harambe Entrepreneur Alliance—is hastening the development of Africa by promoting smaller and more daring actions.
More RSS Feed for Cisco: newsroom.cisco.com/rss-feeds ...



  • Corporate Social Responsibility

ph

Coronavirus | Chennai-based ayurvedic pharmacist dies after drinking concoction of his own preparation

Managing Director of the firm faints after tasting the chemical




ph

[ASAP] Room Temperature Graphene Mid-Infrared Bolometer with a Broad Operational Wavelength Range

ACS Photonics
DOI: 10.1021/acsphotonics.0c00028




ph

[ASAP] Size, Ligand, and Defect-Dependent Electron–Phonon Coupling in Chalcogenide and Perovskite Nanocrystals and Its Impact on Luminescence Line Widths

ACS Photonics
DOI: 10.1021/acsphotonics.0c00034




ph

[ASAP] Directional off-Normal Photon Streaming from Hybrid Plasmon-Emitter Coupled Metasurfaces

ACS Photonics
DOI: 10.1021/acsphotonics.0c00196




ph

[ASAP] Colloidal Quantum-Dots/Graphene/Silicon Dual-Channel Detection of Visible Light and Short-Wave Infrared

ACS Photonics
DOI: 10.1021/acsphotonics.0c00247




ph

[ASAP] Near-Field Radiative Heat Transfer between Dissimilar Materials Mediated by Coupled Surface Phonon- and Plasmon-Polaritons

ACS Photonics
DOI: 10.1021/acsphotonics.0c00404




ph

[ASAP] Chip-Scale Reconfigurable Optical Full-Field Manipulation: Enabling a Compact Grooming Photonic Signal Processor

ACS Photonics
DOI: 10.1021/acsphotonics.0c00103




ph

[ASAP] Ultrafast Colloidal Quantum Dot Infrared Photodiode

ACS Photonics
DOI: 10.1021/acsphotonics.0c00363




ph

Iconography of Security

Molly Wilson and Eileen Wagner battle the age old Christmas issues of right and wrong, good and evil, and how the messages we send through iconography design can impact the decisions users make around important issues of security. Are you icons wise men, or are they actually King Herod?


Congratulations, you’re locked out! The paradox of security visuals

Designers of technology are fortunate to have an established visual language at our fingertips. We try to use colors and symbols in a way that is consistent with people’s existing expectations. When a non-designer asks a designer to “make it intuitive,” what they’re really asking is, “please use elements people already know, even if the concept is new.”

Lots of options for security icons

We’re starting to see more consistency in the symbols that tech uses for privacy and security features, many of them built into robust, standardized icon sets and UI kits. To name a few: we collaborated with Adobe in 2018 to create the Vault UI Kit, which includes UI elements for security, like touch ID login and sending a secure copy of a file. Adobe has also released a UI kit for cookie banners.

Activity log from the Vault Secure UI Kit, by Adobe and Simply Secure.
Cookie banner, from the Cookie Banner UI Kit, by Adobe.

Even UI kits that aren’t specialized in security and privacy include icons that can be used to communicate security concepts, like InVision’s Smart Home UI Kit. And, of course, nearly every icon set has security-related symbols, from Material Design to Iconic.

Key, lock, unlock, shield, and warning icons from Iconic.
A selection of security-related icons from Material Design.
Security shields from a selection of Chinese apps, 2014. From a longer essay by Dan Grover.

Many of these icons allude to physical analogies for the states and actions we’re trying to communicate. Locks and keys; shields for protection; warning signs and stop signs; happy faces and sad faces. Using these analogies helps build a bridge from the familiar, concrete world of door locks and keyrings to the unfamiliar, abstract realm of public- and private-key encryption.

flickr/Jim Pennucci
GPG Keychain, an open-source application for managing encryption keys. Image: tutsplus.com

When concepts don’t match up

Many of the concepts we’re working with are pairs of opposites. Locked or unlocked. Private or public. Trusted or untrusted. Blocked or allowed. Encouraged or discouraged. Good or evil. When those concept pairs appear simultaneously, however, we quickly run into UX problems.

Take the following example. Security is good, right? When something is locked, that means you’re being responsible and careful, and nobody else can access it. It’s protected. That’s cause for celebration. Being locked and protected is a good state.

“Congratulations, you’re locked out!”

Whoops.

If the user didn’t mean to lock something, or if the locked state is going to cause them any inconvenience, then extra security is definitely not good news.

Another case in point: Trust is good, right? Something trusted is welcome in people’s lives. It’s allowed to enter, not blocked, and it’s there because people wanted it there. So trusting and allowing something is good.

“Good job, you’ve downloaded malware!”

Nope. Doesn’t work at all. What if we try the opposite colors and iconography?

That’s even worse. Even though we, the designers, were trying both times to keep the user from downloading malware, the user’s actual behavior makes our design completely nonsensical.

Researchers from Google and UC Berkeley identified this problem in a 2016 USENIX paper analyzing connection security indicators. They pointed out that, when somebody clicks through a warning to an “insecure” website, the browser will show a “neutral or positive indicator” in the URL bar – leading them to think that the website is now safe. Unlike our example above, this may not look like nonsense from the user point of view, but from a security standpoint, suddenly showing “safe/good” without any actual change in safety is a pretty dangerous move.

The deeper issue

Now, one could file these phenomena under “mismatching iconography,” but we think there is a deeper issue here that concerns security UI in particular. Security interface design pretty much always has at least a whiff of “right vs. wrong.” How did this moralizing creep into an ostensibly technical realm?

Well, we usually have a pretty good idea what we’d like people to do with regards to security. Generally speaking, we’d like them to be more cautious than they are (at least, so long as we’re not trying to sneak around behind their backs with confusing consent forms and extracurricular data use). Our well-intentioned educational enthusiasm leads us to use little design nudges that foster better security practices, and that makes us reach into the realm of social and psychological signals. But these nudges can easily backfire and turn into total nonsense.

Another example: NoScript

“No UX designer would be dense enough to make these mistakes,” you might be thinking.

Well, we recently did a redesign of the open-source content-blocking browser extension NoScript, and we can tell you from experience: finding the right visual language for pairs of opposites was a struggle.

NoScript is a browser extension that helps you block potential malware from the websites you’re visiting. It needs to communicate a lot of states and actions to users. A single script can be blocked or allowed. A source of scripts can be trusted or untrusted. NoScript is a tool for the truly paranoid, so in general, wants to encourage blocking and not trusting. But:

“An icon with a crossed-out item is usually BAD, and a sign without anything is usually GOOD. But of course, here blocking something is actually GOOD, while blocking nothing is actually BAD. So whichever indicators NoScript chooses, they should either aim to indicate system state [allow/block] or recommendation [good/bad], but not both. And in any case, NoScript should probably stay away from standard colors and icons.”

So we ended up using hardly any of the many common security icons available. No shields, no alert! signs, no locked locks, no unlocked locks. And we completely avoided the red/green palette to keep from taking on unintended meaning.

Navigating the paradox

Security recommendations appear in most digital services are built nowadays. As we move into 2020, we expect to see a lot more conscious choice around colors, icons, and words related to security. For a start, Firefox already made a step in the right direction by streamlining indicators for SSL encryption as well as content blocking. (Spoilers: they avoided adding multiple dimensions of indicators, too!)

The most important thing to keep in mind, as you’re choosing language around security and privacy features, is: don’t conflate social and technical concepts. Trusting your partner is good. Trusting a website? Well, could be good, could be bad. Locking your bike? Good idea. Locking a file? That depends.

Think about the technical facts you’re trying to communicate. Then, and only then, consider if there’s also a behavioral nudge you want to send, and if you are, try to poke holes in your reasoning. Is there ever a case where your nudge could be dangerous? Colors, icons, and words give you a lot of control over how exactly people experience security and privacy features. Using them in a clear and consistent way will help people understand their choices and make more conscious decisions around security.


About the author

Molly Wilson is a designer by training and a teacher at heart: her passion is leveraging human-centered design to help make technology clear and understandable. She has been designing and leading programs in design thinking and innovation processes since 2010, first at the Stanford d.school in Palo Alto, CA and later at the Hasso-Plattner-Institut School of Design Thinking in Potsdam, Germany. Her work as an interaction designer has focused on complex products in finance, health, and education. Outside of work, talk to her about cross-cultural communication, feminism, DIY projects, and visual note-taking.

Molly holds a master’s degree in Learning, Design, and Technology from Stanford University, and a bachelor’s degree magna cum laude in History of Science from Harvard University. See more about her work and projects at http://molly.is.

Eileen Wagner is Simply Secure’s in-house logician. She advises teams and organizations on UX design, supports research and user testing, and produces open resources for the community. Her focus is on information architecture, content strategy, and interaction design. Sometimes she puts on her admin hat and makes sure her team has the required infrastructure to excel.

She previously campaigned for open data and civic tech at the Open Knowledge Foundation Germany. There she helped establish the first public funding program for open source projects in Germany, the Prototype Fund. Her background is in analytic philosophy (BA Cambridge) and mathematical logic (MSc Amsterdam), and she won’t stop talking about barbershop music.

More articles by Molly Wilson & Eileen




ph

Building a Dictaphone Using Media Recorder and getUserMedia

Chris Mills brushes up his shorthand and shows how the MediaStream Recording API in modern browsers can be used to capture audio directly from the user’s device. Inching ever closer to the capabilities of native software, it truly is an exciting time to be a web developer.


The MediaStream Recording API makes it easy to record audio and/or video streams. When used with MediaDevices.getUserMedia(), it provides an easy way to record media from the user’s input devices and instantly use the result in web apps. This article shows how to use these technologies to create a fun dictaphone app.

A sample application: Web Dictaphone

To demonstrate basic usage of the MediaRecorder API, we have built a web-based dictaphone. It allows you to record snippets of audio and then play them back. It even gives you a visualisation of your device’s sound input, using the Web Audio API. We’ll just concentrate on the recording and playback functionality in this article, for brevity’s sake.

You can see this demo running live, or grab the source code on GitHub. This has pretty good support on modern desktop browsers, but pretty patchy support on mobile browsers currently.

Basic app setup

To grab the media stream we want to capture, we use getUserMedia(). We then use the MediaRecorder API to record the stream, and output each recorded snippet into the source of a generated <audio> element so it can be played back.

We’ll first declare some variables for the record and stop buttons, and the <article> that will contain the generated audio players:

const record = document.querySelector('.record');
const stop = document.querySelector('.stop');
const soundClips = document.querySelector('.sound-clips');

Next, we set up the basic getUserMedia structure:

if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
   console.log('getUserMedia supported.');
   navigator.mediaDevices.getUserMedia (
      // constraints - only audio needed for this app
      {
         audio: true
      })

      // Success callback
      .then(function(stream) {

      })

      // Error callback
      .catch(function(err) {
         console.log('The following `getUserMedia` error occured: ' + err);
      }
   );
} else {
   console.log('getUserMedia not supported on your browser!');
}

The whole thing is wrapped in a test that checks whether getUserMedia is supported before running anything else. Next, we call getUserMedia() and inside it define:

  • The constraints: Only audio is to be captured for our dictaphone.
  • The success callback: This code is run once the getUserMedia call has been completed successfully.
  • The error/failure callback: The code is run if the getUserMedia call fails for whatever reason.

Note: All of the code below is found inside the getUserMedia success callback in the finished version.

Capturing the media stream

Once getUserMedia has created a media stream successfully, you create a new Media Recorder instance with the MediaRecorder() constructor and pass it the stream directly. This is your entry point into using the MediaRecorder API — the stream is now ready to be captured into a <Blob>, in the default encoding format of your browser.

const mediaRecorder = new MediaRecorder(stream);

There are a series of methods available in the MediaRecorder interface that allow you to control recording of the media stream; in Web Dictaphone we just make use of two, and listen to some events. First of all, MediaRecorder.start() is used to start recording the stream once the record button is pressed:

record.onclick = function() {
  mediaRecorder.start();
  console.log(mediaRecorder.state);
  console.log("recorder started");
  record.style.background = "red";
  record.style.color = "black";
}

When the MediaRecorder is recording, the MediaRecorder.state property will return a value of “recording”.

As recording progresses, we need to collect the audio data. We register an event handler to do this using mediaRecorder.ondataavailable:

let chunks = [];

mediaRecorder.ondataavailable = function(e) {
  chunks.push(e.data);
}

Last, we use the MediaRecorder.stop() method to stop the recording when the stop button is pressed, and finalize the Blob ready for use somewhere else in our application.

stop.onclick = function() {
  mediaRecorder.stop();
  console.log(mediaRecorder.state);
  console.log("recorder stopped");
  record.style.background = "";
  record.style.color = "";
}

Note that the recording may also stop naturally if the media stream ends (e.g. if you were grabbing a song track and the track ended, or the user stopped sharing their microphone).

Grabbing and using the blob

When recording has stopped, the state property returns a value of “inactive”, and a stop event is fired. We register an event handler for this using mediaRecorder.onstop, and construct our blob there from all the chunks we have received:

mediaRecorder.onstop = function(e) {
  console.log("recorder stopped");

  const clipName = prompt('Enter a name for your sound clip');

  const clipContainer = document.createElement('article');
  const clipLabel = document.createElement('p');
  const audio = document.createElement('audio');
  const deleteButton = document.createElement('button');

  clipContainer.classList.add('clip');
  audio.setAttribute('controls', '');
  deleteButton.innerHTML = "Delete";
  clipLabel.innerHTML = clipName;

  clipContainer.appendChild(audio);
  clipContainer.appendChild(clipLabel);
  clipContainer.appendChild(deleteButton);
  soundClips.appendChild(clipContainer);

  const blob = new Blob(chunks, { 'type' : 'audio/ogg; codecs=opus' });
  chunks = [];
  const audioURL = window.URL.createObjectURL(blob);
  audio.src = audioURL;

  deleteButton.onclick = function(e) {
    let evtTgt = e.target;
    evtTgt.parentNode.parentNode.removeChild(evtTgt.parentNode);
  }
}

Let’s go through the above code and look at what’s happening.

First, we display a prompt asking the user to name their clip.

Next, we create an HTML structure like the following, inserting it into our clip container, which is an <article> element.

<article class="clip">
  <audio controls></audio>
  <p>_your clip name_</p>
  <button>Delete</button>
</article>

After that, we create a combined Blob out of the recorded audio chunks, and create an object URL pointing to it, using window.URL.createObjectURL(blob). We then set the value of the <audio> element’s src attribute to the object URL, so that when the play button is pressed on the audio player, it will play the Blob.

Finally, we set an onclick handler on the delete button to be a function that deletes the whole clip HTML structure.

So that’s basically it — we have a rough and ready dictaphone. Have fun recording those Christmas jingles! As a reminder, you can find the source code, and see it running live, on the MDN GitHub.


This article is based on Using the MediaStream Recording API by Mozilla Contributors, and is licensed under CC-BY-SA 2.5.


About the author

Chris Mills manages the MDN web docs writers’ team at Mozilla, which involves spreadsheets, meetings, writing docs and demos about open web technologies, and occasional tech talks at conferences and universities. He used to work for Opera and W3C, and enjoys playing heavy metal drums and drinking good beer.

More articles by Chris




ph

A Modern Typographic Scale

Rob Weychert reaches for the top notes to sing us a song of typographic scale. A little attention to scale and to the mathematics will help you to hit a high note with your designs this Christmas and beyond.


I’ve been studying music theory this year. While some of its core concepts were already familiar to me, much of their specifics were not. Or so I thought. A funny thing happened when I was learning the major scales.

While playing through a song I had written some years before, I started picking it apart to see how it correlated with the theory I was learning. I had composed the melody without any thought to what the specific notes were, but as I started to transcribe them, a pattern quickly emerged: all the B’s and E’s were flat and the rest of the notes were natural. Lo and behold, long before my music theory studies began, I had written a song in B♭ major. My ears already knew how the major scales worked even if my brain didn’t. (If you know how “do re mi fa so la ti do” is supposed to sound tonally, then your ears know, too.)

When music is composed to a scale, it sounds “right” to us. And just as our ears appreciate harmony and melody with a rational basis, our eyes can appreciate the same concepts applied to spatial relationships.

Have you ever struggled with sizing type in a design project, especially when you need more than just one or two sizes? Have you ever despaired at the number of ad-hoc type sizes on your site spiraling out of control over time? It could be that you’ve been composing the typographic equivalent of a cacophonous symphony. And the first thing any composer will tell you to do is to get that thing on a scale.

Meet the typographic scale

You don’t need to know music theory to work with a typographic scale. You only need to know that a scale is a range of values with an established mathematic relationship. For a typographic scale, that relationship is frequently a steady interval between type sizes. Depending on what you need your type to do, the interval might be fixed (e.g. each size is two pixels bigger than the size before it) or it might be proportional (e.g. each size is twice as big as the size before it). I personally rarely find fixed intervals useful, so I’ll be focusing on proportional intervals.

The most important thing to understand about proportional intervals is thankfully not complicated: The bigger the intervals are, the more drastic the size differences will be in your scale. If your layout calls for contrast, a bigger interval might be the way to go. If you’re aiming for something more nuanced, go smaller. But keep these things in mind:

  • There is such a thing as too much nuance: if a size on your scale is virtually indistinguishable from the sizes adjacent to it, it defeats the purpose of using a scale.
  • On the flip side, too much contrast renders the sizes’ proportional relationship moot. At a certain point, massive display type is arguably more graphic than textual.
  • More is less. The more sizes you use, the less they’ll mean.
A small interval (left, 1.1) offers a smoother range of sizes; a large interval (right, 1.8) offers more contrast.

Setting up the scale variables

The quickest way to get a scale up and running when working on the web is to drop its values into some CSS variables. The naming convention I typically use begins with --scale0, which is the body text size. The size below it is --scale-1 (as in “scale minus one”), the size above it is --scale1, and so on. Keeping the names relative to each other like this helps me move around the scale intuitively as I use it. If, say, --scale4 isn’t big enough for my h1, I can move up to --scale5 or --scale6, and I always know exactly how many steps away from the body text I am. Here’s a first pass at a simple set of scale variables using an interval of 1.5:

:root {
  --scale-2: 7.1px;  /* 10.7 ÷ 1.5 */
  --scale-1: 10.7px; /* 16 ÷ 1.5   */
  --scale0: 16px;    /* body text  */
  --scale1: 24px;    /* 16 × 1.5   */
  --scale2: 36px;    /* 24 × 1.5   */
}

I can use these variables with any CSS property that accepts a numeric value, like so:

p { font-size: var(--scale0); }

Rooting around in rems

I’m off to a good start. However, those px values are a little too absolute for my liking. If I convert them to rems, it’ll give my scale more flexibility. rem stands for “root em.” 1rem is equivalent to the html element’s text size, which in most browsers defaults to 16px. Crucially, though, users can adjust that size in their browser settings, and using rems in my CSS will respect those preferences.

:root {
  --scale-2: 0.4rem;  /* 0.7rem ÷ 1.5 */
  --scale-1: 0.7rem;  /* 1rem ÷ 1.5   */
  --scale0: 1rem;     /* body text    */
  --scale1: 1.5rem;   /* 1rem × 1.5   */
  --scale2: 2.25rem;  /* 1.5rem × 1.5 */
}

Another benefit of the relative nature of rems: I tend to use larger text sizes on large viewports and smaller text sizes on small viewports. Rather than adjusting dozens or hundreds of typographic CSS declarations per breakpoint, I can shift the whole scale up or down merely by adjusting the font-size on the html element:

html { font-size: 100%; }     /* 1rem = 16px */

@media screen and (min-width: 25em) {
  html { font-size: 112.5%; } /* 1rem = 18px */
}

Calculating with calc()

My scale is coming along. Its variables’ intuitive names make it easy for me to use, and its rem values respect the user’s browser preferences and allow me to easily shift the size of the entire scale at different viewport sizes. But my setup still isn’t optimized for one very important adjustment: the interval, which is currently 1.5. If 1.5 isn’t quite working for me and I want to see how an increase or decrease will affect the scale, I need to do the math all over again for every step in the scale every time I adjust the interval. The bigger the scale, the more time that will take. It’s time to put down the abacus and get calc() involved.

:root {
  --int: 1.5;
  --scale0: 1rem;
  --scale-1: calc(var(--scale0) / var(--int));
  --scale-2: calc(var(--scale-1) / var(--int));
  --scale1: calc(var(--scale0) * var(--int));
  --scale2: calc(var(--scale1) * var(--int));
}

My interval now has its very own variable, called --int. calc() determines each scale size by multiplying the preceding size by --int. Now that every size is ultimately dependent on --scale0’s value, --scale0 must appear first in the list. Since the sizes smaller than --scale0 are going down rather than up, their values require division rather than multiplication.

Scaling the scale

I can now quickly and easily tweak my scale’s interval by adjusting --int until the proportions are just right, but if I want to add more sizes to the scale, I need to add more variables and calc() values. This isn’t too big of a deal, but if I want to double or triple the number of sizes, it’s kind of a headache. Luckily, this is the sort of thing Sass is really good at. In the following code, adjusting the first four Sass variables at the top of :root will quickly spin up a set of CSS variables like the scale above, with any interval (proportional or fixed) and any number of scale sizes:

:root {
  $interval: 1.5;    // Unitless for proportional, unit for fixed
  $body-text: 1rem;  // Must have a unit
  $scale-min: -2;    // Unitless negative integer
  $scale-max: 2;     // Unitless positive integer

  --int: #{$interval};
  --scale0: #{$body-text};

  @if $scale-min < 0 {
  // Generate scale variables smaller than the base text size
    @for $i from -1 through $scale-min {
      @if type-of($interval) == number {
        @if unitless($interval) {
          --scale#{$i}: calc(var(--scale#{$i + 1}) / var(--int));
        } @else {
          --scale#{$i}: calc(var(--scale#{$i + 1}) - var(--int));
        }
      }
    }
  }
  @if $scale-max > 0 {
    // Generate scale variables larger than the base text size
    @for $i from 1 through $scale-max {
      @if type-of($interval) == number {
        @if unitless($interval) {
          --scale#{$i}: calc(var(--scale#{$i - 1}) * var(--int));
        } @else {
          --scale#{$i}: calc(var(--scale#{$i - 1}) + var(--int));
        }
      }
    }
  }
}

Go forth and scale

Typographic scales have been an indispensable part of my work for many years, and CSS variables and calc() make setup, adjustments, and experimentation easier than ever. I hope you find these techniques as useful as I do!


About the author

Rob Weychert is a Brooklyn-based designer. He helps shape the reading experience at ProPublica and has previously helped make books at A Book Apart, games at Harmonix, and websites at Happy Cog. In his free time, he obsesses over music and film. Despite all this, he is probably best known as a competitive air guitarist.

More articles by Rob




ph

Cigarette taxes and smoking among sexual minority adults [electronic resource] / Christopher Carpenter, Dario Sansone

Cambridge, Mass. : National Bureau of Economic Research, 2020




ph

Cigarette taxes and teen marijuana use [electronic resource] / D. Mark Anderson, Kyutaro Matsuzawa, Joseph J. Sabia

Cambridge, Mass. : National Bureau of Economic Research, 2020




ph

DUTRA GROUP v. BATTERTON, CHRISTOPHER. Decided 06/24/2019




ph

How to democratize Europe / Stephanie Hennette, Thomas Piketty, Guillaume Sacriste, Antoine Vauchez

Online Resource




ph

Homeland security and public safety: research, applications and standards / editors, Philip J. Mattson and Jennifer L. Marshall

Barker Library - UA23.H538 2019




ph

The sovereignty game: Neo-Colonialism and the Westphalian System / Will Hickey

Online Resource




ph

Territorial sovereignty: a philosophical exploration / Anna Stilz

Dewey Library - JC327.S79 2019




ph

Assessment of the in-house laboratory independent research at the Army's Research, Development, and Engineering Centers / Army Research Program Review and Analysis Committee, Division on Engineering and Physical Sciences

Online Resource




ph

The lost soul of the American presidency: the decline into demagoguery and the prospects for renewal / Stephen F. Knott

Dewey Library - JK511.K66 2019




ph

America's use of terror: from Colonial times to the A-bomb / Stephen Huggins

Dewey Library - HV6432.H8244 2019




ph

The light that failed: why the West is losing the fight for democracy / Ivan Krastev and Stephen Holmes

Dewey Library - JC574.K74 2019




ph

Tyranny comes home: the domestic fate of U.S. militarism / Christopher J. Coyne and Abigail R. Hall

Dewey Library - UA23.C685 2018




ph

Imperial nation: ruling citizens and subjects in the British, French, Spanish, and American empires / Joseph M. Fredera ; translated by Ruth MacKay

Dewey Library - JC359.F6313 2018




ph

Principled spying: the ethics of secret intelligence / David Omand and Mark Phythian

Dewey Library - JF1525.I6 O42 2018




ph

Clearer than truth: the polygraph and the American Cold War / John Philipp Baesler

Dewey Library - JK468.L5 B34 2018




ph

Exploring political legacies Stephen Farrall, Colin Hay, Emily Gray

Online Resource




ph

Encephalitis claims four more lives in Uttar Pradesh, toll 275

1,347 encephalitis patients have been admitted to various hospitals since January.




ph

Encephalitis claims 11 lives in 3 days; toll climbs to 330

As many as 60 fresh encephalitis patients have been admitted to the government hospital.




ph

'Phailin' intensifies into severe cyclonic storm, to hit Odisha and Andhra on Saturday

Squally winds speed reaching 65 kmph would hit Odisha and north Andhra on Friday morning,




ph

Naveen Patnaik asks for IAF, Navy help as cyclone Phailin approaches

Cyclone Phailin, the strongest to form on the Indian seas this year, moved closer to Orissa coast.




ph

Phailin not less than super cyclone, wind speed likely to reach 220 kmph

The IMD forecast waves up to 2.5 meter to 3.0 meter high in Ganjam, Khurda, Puri.




ph

Cyclone Phailin: Antony asks armed forces to be ready

IAF assets have been kept on stand by at various bases, including Raipur and Gwalior.




ph

Cyclon Phailin: Odisha opens helpline for storm updates

The helpline number of the Odisha Central Control Room is 0674-2534177.




ph

Cyclone Phailin: What to do and what not

With Phailin expected to make a landfall on Saturday, NDMA provides measures to be followed.




ph

Phailin to be one of the strongest cyclones to hit India: US experts

Tropical Cyclone Phailin has maintained Category five strength for six hours.




ph

Odisha evacuates 2.5 lakh people as Phailin approaches

Cyclonic storm Phailin is currently positioned just 260 km off the coast of Gopalpur.




ph

Cyclone Phailin: Jharkhand govt alerts districts as storm approaches

MeT said the cyclonic storm is expected to enter the state on Sunday morning.




ph

'Phailin' cripples wheels between Bhubaneshwar and coastal areas

Cancellation of trains and buses towards coastal areas of the state will hit the commuters.




ph

Odisha, Andhra brace for devastation as Cyclone Phailin approaches

Filling most of the Bay of Bengal, Cyclone Phailin is expected to hit between 6-8pm.