首页 > 编程知识 正文

属性与生活2插件,属性与生活2修改器

时间:2023-05-06 13:23:05 阅读:162086 作者:3016

缓和变量可以为负吗

sackstilldoesn’thaveadarkmode.theyhavedarkthemes,butthoseonlyletyoucustomizethesidebarcolors, leavingthemainwindowwhite.withthereleaseofsystem-widedarkmodesonmacosmojaveandwindows 10,Slack feels very out of place。

Slack还没有黑暗模式。 虽然有较暗的主题,但这些主题只能自定义侧栏的颜色,主窗口仍为白色。 随着macOS Mojave和Windows 10上发布的系统范围的暗模式,我觉得Slack不合适。

thismethodisunofficialandinvolvesdiggingaroundinthesourcefilesforslack.it’sfairlyeasytodo,butsinceitwillbeoverwritttteneveved

该方法是非正式的,需要在Slack源文件中挖掘。 这很简单,但每次更新都会被复盖,因此必须多次执行此操作。

主题(Downloading a Theme ) Since Slack runs on Electron、 下载aframeworkfordevelopingdesktopnode.js apps,youcaneditthestylesforitlikeyou’deditthecssofawebsite.butthecssfilesfileste

Slack在Electron (开发桌面node.js APP应用程序的框架)中运行,因此可以像编辑网站CSS一样编辑样式。 但是,SlackCSS文件隐藏在源代码中,因此必须加载自己的主题。

themostpopulartruedarkmodethemeisslack-black-themebywidget.andsinceelectronsharescodeacrossplatforms, thisthemewillworkonwindowsandlinuxaswell.wefoundthereweresomeissueswithethemeonmacosmojavethough,soifitdoesn’tworkthend

最受欢迎的真正的暗模式主题是小部件的“slack-black-theme”。 由于Electron在跨平台上共享代码,因此本主题也在Windows和Linux上运行。 如果您发现macOS Mojave主题存在一些问题,并且该主题不起作用,请尝试使用fork。 这仅适用于MAC操作系统,但也可能适用于Windows用户。

修补程序松弛This part,you’llhavetodoagaineverytimeslackupdates.onmacintosh,youcangettoslack’sourcedirectosh

每次更新Slack时,都必须重新运行此部分。 在macOS中,可以通过右键单击APP应用程序本身并选择“查看包内容”来访问Slack的源目录。 在Windows上,可以在~AppDataLocalslack中找到。

Then, navigateafewfoldersdowntoresources/app.asar.unpacked/src/static/. you’regoingtowanttofindthessb-interop were you openthatfileinyourfavoritetexteditor,and scroll to the bottom:

然后,我把一些文件夹

导航到resources/app.asar.unpacked/src/static/ 。 您将要找到ssb-interop.js文件,您将在其中编辑代码。 确保关闭了Slack,在您喜欢的文本编辑器中打开该文件,然后滚动到底部:

Copy and paste the following code at the very end of the ssb-interop.js file:

将以下代码复制并粘贴到ssb-interop.js文件的末尾:

// First make sure the wrapper app is loadeddocument.addEventListener("DOMContentLoaded", function() { // Then get its webviews let webviews = document.querySelectorAll(".TeamView webview"); // Fetch our CSS in parallel ahead of time const cssPath = 'https://cdn.rawgit.com/widget-/slack-black-theme/master/custom.css'; let cssPromise = fetch(cssPath).then(response => response.text()); let customCustomCSS = ` :root { /* Modify these to change your theme colors: */ --primary: #09F; --text: #CCC; --background: #080808; --background-elevated: #222; } ` // Insert a style tag into the wrapper view cssPromise.then(css => { let s = document.createElement('style'); s.type = 'text/css'; s.innerHTML = css + customCustomCSS; document.head.appendChild(s); }); // Wait for each webview to load webviews.forEach(webview => { webview.addEventListener('ipc-message', message => { if (message.channel == 'didFinishLoading') // Finally add the CSS into the webview cssPromise.then(css => { let script = ` let s = document.createElement('style'); s.type = 'text/css'; s.id = 'slack-custom-css'; s.innerHTML = `${css + customCustomCSS}`; document.head.appendChild(s); ` webview.executeJavaScript(script); }) }); });});

You’ll probably want to duplicate this file and save it in a different location, so you don’t have to edit the code every time. This way, you can just drag it into the directory to overwrite the newest version:

您可能需要复制此文件并将其保存在其他位置,因此您不必每次都编辑代码。 这样,您可以将其拖到目录中以覆盖最新版本:

After you’re done, reopen Slack, and after a few seconds the dark mode should kick in. The loading screen will still be white, but the main app window will blend in much better with the rest of your system:

完成后,重新打开Slack,几秒钟后,将进入黑暗模式。加载屏幕仍为白色,但主应用程序窗口将与系统的其余部分更好地融合在一起:

添加自己的主题 (Adding Your Own Themes)

If you don’t like the look of it, you can edit the CSS with any styles you want. All this code does is load custom styles from https://cdn.rawgit.com/widget-/slack-black-theme/master/custom.css; you can download that file, edit it with your changes, and replace the URL with your own code. Save, relaunch Slack, and your changes will be visible. If you don’t know CSS, or just want to make a minor change, there are four color variables defined before loading the CSS, so you can just edit those with your own colors.

如果您不喜欢它的外观,则可以使用所需的任何样式来编辑CSS。 这些代码所做的只是从https://cdn.rawgit.com/widget-/slack-black-theme/master/custom.css加载自定义样式; 您可以下载该文件,进行更改后进行编辑,然后将URL替换为自己的代码。 保存并重新启动Slack,您的更改将可见。 如果您不了解CSS,或者只是想作一些小的更改,则在加载CSS之前定义了四个颜色变量,因此您可以使用自己的颜色进行编辑。

翻译自: https://www.howtogeek.com/368976/how-to-install-the-unofficial-dark-mode-for-slack/

松弛变量可以为负吗

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。