如何在 Linux 中以编程方式反转屏幕颜色

编程入门 行业动态 更新时间:2024-10-28 05:27:17
本文介绍了如何在 Linux 中以编程方式反转屏幕颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

例如在 Ubuntu 中,您可以使用 Super-M 来反转屏幕颜色(需要桌面效果,请参阅 [1]).其他操作系统也有类似的能力,尽管我并不真正关心 Linux 以外的任何东西.

In Ubuntu, for example, you can use Super-M to invert the screen colors (requires desktop effects, see [1]). Other OSes have similar abilities, although I'm not really concerned with anything other than Linux.

如果我想编写一个在运行时反转屏幕颜色的简单程序,我应该研究哪个 API?

Which API should I look into if I want to write a simple program that, when run, inverts the screen colors?

我使用 API 的语言对我来说并不重要.我对 C/C++/Bash/Perl/Python 非常熟悉,所以我可以用任何最容易访问这个 API 的语言来解决这个问题.需要在 Ubuntu 上工作,在其他类似的 *nix 上工作并不是很重要.

The language that I use the API from doesn't particularly matter to me. I am familiar enough with C/C++/Bash/Perl/Python that I can hack this up in whatever language has the easiest access to this API. Working on Ubuntu is required, working on other similar *nixes is not terribly important.

[1] https://help.ubuntu/community/KeyboardShortcuts#Desktop%20Effects%20enabled%20shortcuts

推荐答案

你可以使用 xcalib 来做些什么你想要.

You could use xcalib to do what you want.

例如,用于反转屏幕颜色的简单 bash 脚本如下所示:

For example, a simple bash script to invert the screen colors would look like this:

#!/bin/bash
xcalib -invert -alter

这篇关于如何在 Linux 中以编程方式反转屏幕颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-29 08:11:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1186682.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中以   屏幕   颜色   方式   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!