Skip Navigation

Suggestions for the Perchance Comments Plugin.

I have noticed that the comments could be styled through the Perchance Panel, however I noticed that the style are not as comprehensive as using traditional CSS would be. It can be easily mitigated by using a CSS file and if there was a way to link the CSS file to the comments plugin. It can be easily achieved as well, if there was an option to write the URL of the CSS file, the comments plugin would only need to append a link with href and rel as style at the end of the iframe to use completely custom and comprehensive CSS.

I have many generators, and in all of them, I use darkmode, and since there were no darkmode buttons for the comments plugin, I just decided to use darkmode as default, however recently I have noticed that some people have eye condition where it is hard for them to read text in darkmode. So it would have been great if the dev could implement a message listener so I could post a message for darkmode from the parent window to the container, of course this would require the comments plugin to handle a darkmode function to apply the dark class to the body inside the iframe. If the dev is consider this, I believe not everyone uses dark as class, so I think making another option for the Perchance Panel as to what the class name could be is great.

Next up, I have thought about images, we upload images in the comments, however what if, we as creators were to predefine sets of images to be used? I think the smarter way would be to look for image links. However the reason I am proposing this is because I wanted to predefine sets of custom emoji, for example, :husk:, I could predefine it and the plugin could format them before sending.

Next, I have thoughts of being able to set up bots. It could be a great innovation. However I do not think this suggestion could be taken into consideration due to its complexity. Bots could be written through JS and the reason I am suggesting this is because I thought of being able to set up an AI using the Perchance AI Text plugin. If the dev is indeed considering this, I believe many people would create their own bots, and thus, there should be a way to share them, which could be done as pure codes, or shared links for files. This suggestion is extremely complex, but this is just my suggestions.

Next, the Perchance Comments Plugin by default has a border, which is completely fine, but I noticed that we are unable to remove that border even if we try to style the container in the Perchance Panel, I am merely bringing this up as a graphical issue, however this, too, should be solved upon being able to use custom comprehensive CSS.

In summary, what I would like are as follows:

  • Custom CSS Linking: I would appreciate adding an option to the Perchance Comments Plugin to allow users to specify a URL for a custom CSS file, allowing comprehensive styling beyond the current options.

  • Dark Mode Accessibility: Implement a message listener for dark mode toggling from the parent window to the plugin container, allowing users to switch between dark and light modes. Additionally, allow customization of the CSS class for dark mode (e.g., .dark).

  • Predefined Images and Custom Emoji: Allow creators to define sets of images to be used in comments. Also, enable the formatting of custom emoji (e.g., :husk:) by predefining them in the plugin.

  • Bots and AI Integration: Though complex, consider adding the ability to set up bots using JavaScript, along with perhaps the ability to use Perchance Plugins. Provide a means to share bot configurations, either as code or shared links for files.

  • Border Styling: Currently, the Perchance Comments Plugin has a default border that cannot be removed even with container styling. This issue should be addressed alongside the ability to use custom CSS.

12
12 comments
  • Regarding the Dark Mode on the comments plugin, you could probably set up a list and change their values depending on your theme variable. So when the user clicks on your main theme switcher, it would also update the container of the comments plugin which would change the styles.

    For example, on the comments here: https://perchance.org/question-this

    I have a checkbox set up for the theme switch. On the comments option, I have

    ...
    forceColorScheme
        dark^[themeInput.checked]
        light^[!themeInput.checked]
    ...
    

    which will 'force' the color scheme of the comments plugin depending on the theme of the page.

    On the theme switch, I just essentially re-create the comments embed with commentsCon.innerHMTL = c(copts) to re-render the new options.

    Since I was also using a remember-plugin so the input on the checkbox is saved.

    • I surely can do that, however I am using custom styles, and to change means I need to ensure a very complex setups. And I would also need to use it in many generators, so it would be extremely beneficial to have a custom style.

      • Okay I just found a trick to make the comments plugin use different appropriate custom styles that matches to the light/dark mode configuration. (There's an alternate solution down below)

        Now, I see in the ai-chat-modern generator there isn't a variable that detects whether the dark mode is on or off, so to create one put this in the list code:

        isDarkMode = [document.body.classList.contains("dark")]
        

        And then you can make a default themes list that consists of the items light and dark accordingly, and then move all the style configurations (except the Defautwidth, Defautheight and DefaultloadFonts) as the child items on your generator like this:

        DefaultThemes
          light
            DefautlmessageBubbleStyle = font-family: "Work Sans"; font-size: 13.5px; background: #f9f9f9; color: #191713; border-radius: 10px; padding: 10px; margin: 10px; margin-block: 25px; border: 1px solid #c1bcb9; margin: 0;
            DefautmessageFeedStyle = background-color: #f8f8f8; background-size: contain, cover; background-repeat: no-repeat; background-position: center, center; overflow-x: auto; display: flex; flex-direction: column-reverse; gap: 10px; padding: 10px; 
            ...
          dark
            DefautlmessageBubbleStyle = font-family: "Work Sans"; font-size: 13.5px; background: #1e1f20; color: #e6e8ec; border-radius: 10px; padding: 10px; margin: 10px; margin-block: 25px; border: 1px solid #313638; margin: 0;
            DefautmessageFeedStyle = background-color: #070707; background-size: contain, cover; background-repeat: no-repeat; background-position: center, center; overflow-x: auto; display: flex; flex-direction: column-reverse; gap: 10px; padding: 10px; 
            ...
        

        (I've already made the full code for the DefaultThemes list that you can take a look here)

        And from here you can replace the [Defautl...Style] variable blocks in the chat options to follow with the light/dark mode configuration. If that'd be too tedious to find and replace each of them manually, I've built a set of regex that can be entered in the find and replace field (press Ctrl+H) of the list code only once:

        Replace: /\[(Defaut.*Style)\]/g

        With: [DefaultThemes[isDarkMode ? "dark" : "light"].$1]

        So the chat options should now look like this:

        chatOne
          replacedDuringUpdate = true
          messageBubbleStyle = [DefaultThemes[isDarkMode ? "dark" : "light"].DefautlmessageBubbleStyle]
          messageFeedStyle = [DefaultThemes[isDarkMode ? "dark" : "light"].DefautmessageFeedStyle]
          inputAreaStyle = [DefaultThemes[isDarkMode ? "dark" : "light"].DefautinputAreaStyle]
          submitButtonStyle = [DefaultThemes[isDarkMode ? "dark" : "light"].DefautsubmitButtonStyle]
          containerStyle = [DefaultcontainerStyle]
          fullscreenButtonStyle = [DefaultThemes[isDarkMode ? "dark" : "light"].DefautfullscreenButtonStyle]
          settingsButtonStyle = [DefaultThemes[isDarkMode ? "dark" : "light"].DefautsettingsButtonStyle]
          ...
        

        Oh, and we also need the comments plugin to match to the appropriate mode right when the mode is switched, so we're going to make a function that updates the chat frames:

        reloadChatFrames() =>
          for (let cpel of document.querySelectorAll("#chat, #custom-chat")) {
            update(cpel);
          }
        

        And then, moving on to HTML code panel, assign the light/dark mode toggle event so that the function runs after the darkMode() like this:

        <button onclick="darkmode(); reloadChatFrames()">
          <i class="fa-solid fa-moon" aria-hidden="true"></i>
          <i class="fa-solid fa-sun" aria-hidden="true"></i>
        </button>
        

        Also, if you want the loading screen to also match with the mode, you can add this into the CSS style:

          .__perchance-comments-loading-facade-12345 {
            background: var(--vanilla-velour) !important;
          }
          .dark .__perchance-comments-loading-facade-12345 {
            background: #181818 !important;
          }
        

        I might create a new example out of this that not only demonstrates this behavior that is applicable to all generators, but also shows that you can have multiple different styles inside the comments plugin, not just light and dark mode custom styles.

  • My guess is this is because Perchance fiddling with comments just now but saying in case @[email protected] doesn't know, my comments on https://perchance.org/beautiful-people just broke somewhat in that the submit button became tiny until i manually made it width 100% and also it no longer scrolls to most recent automatically, which i temp fixed by having recent at the top. I notice most people's comment sections are unaffected, tho the last two comment sections on the comment plugin page about halfway down are affected as mine is.

  • Perchance Dev, I forgot to mention one more thing about the custom styles. Not everyone may be using a CDN hosted stylesheet, in such a scenario, I think a style tag with an ID might be more suited to having a custom and comprehensive style.

  • It seems like the Custom Emoji suggestion has been made into reality!! This really hit me up, because when I had a lot of pending planned updates of my generators, at least an average-scaled update on an official plugin and stuff pushes me up a little bit to realize those updates and gather more forgotten updates on my note bank in a way I could. But that's another story.

    There is now a green bar on the top of the comments plugin page telling that:

    New: You can now add custom emojis to your chat. Here's an example.

12 comments