如何在 Linux 中以编程方式反转屏幕颜色 [英] How to programmatically invert screen colors in Linux

查看:27
本文介绍了如何在 Linux 中以编程方式反转屏幕颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如在 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.com/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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆