perchance

joined 1 year ago
MODERATOR OF
 

It basically allows you to specify to different colors - one for if the user's device is in light mode, and the other if they're in dark mode. Here's an example gen showing how to use it:

https://perchance.org/css-light-dark-test#edit

<style>
  html { color-scheme: light dark; } /* this line is important! otherwise the code below won't work */
  
  body {
    background: light-dark(lightgrey, black);
  }
</style>

<p style=" color:light-dark(blue,lime); ">this text will be blue in light mode and lime in dark mode</p>

Note that this is a very new browser feature, and a lot of people are on older browser versions, so for at least the next few months you should probably still add a default color before your light-dark color like color:blue; color:light-dark(blue,lime);. That way the older browsers will still get the right colors, but in the newer browsers the light-dark color will override the default color.

1
submitted 5 months ago* (last edited 5 months ago) by perchance@lemmy.world to c/perchance@lemmy.world
 

I know there are a few people here who enjoy archiving - e.g. https://perchance.org/vionet20-abulafia-conversions

So I figured I'd mention this which I just stumbled across - from this post:

https://www.stevensavage.com/blog/2023/09/seventh-sanctum-next.html

I’m going to start making my generator notes and data available to you. The data is pretty easy to just bundle up, but I also want to make some notes on how to use it. I’ll make this very visible on the site so you can just download it and go do your own thing.

Replicate my generators. Enhance them. Build your own. Learn from them. Whatever works for you.

I know I can’t maintain the site forever – if nothing else, I won’t be around forever.

Perchance, on the other hand is going to be around until the heat death of the universe, so if anyone wants to help Steven preserve his work via Perchance versions of his gens, here's the data:

https://www.seventhsanctum.com/archive/sanctumdata.zip

If you work out the conversion rules, I or someone else can write the JavaScript code for a mostly-automated converter.

 

First, some context:

When you call list.evaluateItem, it evaluates the square and curly blocks of course, but it also removes backslashes that were before any square or curly blocks. Backslashes are used to tell the Perchance engine that a square or curly bracket should be interpreted 'literally' - i.e. not as a character with a special meaning.

So, for example if we call evaluateItem on a list item like this: {1|2|3} \[cool\] the output will be something like 2 [cool]. If we didn't put the backslash before the square bracket, the Perchance engine would look for a variable/list called "cool" and if it didn't find one, you'd get an error. The backslash says "treat this as a normal/literal square bracket - not a fancy Perchance thing".

Now to the point of this post:

Notice how in the above example of using evaluateItem on a list, the output (2 [cool]) has the backslashes removed? As previously mentioned, that is the correct/desired behavior. But I just found a bug where if you call evaluateItem on a string like {1|2|3} \[cool\] it would output 2 \[cool\] instead of 2 [cool].

I've just fixed this bug - so the backslashes are now removed (just like when using evaluateItem on lists and list items), but I've made it so the bugfix is only applied when you next save your generator - just in case there are any issues with the fix. So please go ahead and save your generator, and if you run into any issues, even if you fixed them, please let me know in the comments. Any examples of issues will help me build an understanding of the effect of this change.

Thanks!

 

For example, if you've made a world building religion generator, and you title it "The Arch Bible" or something like that (i.e. something that's more of a "brand" than a "description"), then people won't be able to use a web search engine to find it unless they already know its name. In other words, people don't search for "The Arch Bible" when they want to find a religion generator - they of course search something like "fantasy religion generator" or whatever - so make sure you put keywords like that in your $meta.title/$meta.description if you want to make it easy for others to find it.

Search engines heavily weight the page title in their search, so it definitely pays to have a $meta.title which appropriately summarizes what your generator does in a few words. It's fine to have something like "Fantasy Religion Generator - The Arch Bible" as your title - i.e. a description, plus a "brand". Just don't leave out the key descriptive terms.

I'm writing this post because I don't think people realize how the "popular" generators on Perchance actually tend to get popular - it's one of two things:

  1. (rare & temporary) The generator happened to go viral on social media somehow.
  2. (common & long-term) The generator's title and/or description was descriptive, and so random people around the world each day hit their page via a Google search, which can add up to thousands of visitors in just a few months if it's a popular "topic" that people search for.

Popular generators almost always get popular via #2, and #2 often eventually leads to #1 - i.e. people find it via a search engine, and then share it with their friends on social media, and then at some point (for whatever reason) it goes viral. I think people tend to incorrectly assume that #1 is the main factor in a generator's popularity (it can be, but it's rare).

TL;DR: Use appropriate descriptive terms in your title and description if you'd like your generator to become well known. Think about the sorts of keywords that people would type into a search engine to find your generator.