From patchwork Fri Jun 9 20:17:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 1178 Return-Path: Received: from mail01.ipfire.org (unknown [172.28.1.200]) by web02.ipfire.org (Postfix) with ESMTP id 3CD2E61C91 for ; Fri, 9 Jun 2017 12:17:55 +0200 (CEST) Received: from mail01.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id 10DEC27FA; Fri, 9 Jun 2017 12:17:55 +0200 (CEST) Received: from ipfire.localdomain (dslb-088-073-203-240.088.073.pools.vodafone-ip.de [88.73.203.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id D0D4B2806; Fri, 9 Jun 2017 12:17:46 +0200 (CEST) From: Jonatan Schlag To: development@lists.ipfire.org, network@lists.ipfire.org Subject: [PATCH 3/6] color: add colors to zone and ports Date: Fri, 9 Jun 2017 12:17:29 +0200 Message-Id: <1497003452-10190-3-git-send-email-jonatan.schlag@ipfire.org> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1497003452-10190-1-git-send-email-jonatan.schlag@ipfire.org> References: <1497003452-10190-1-git-send-email-jonatan.schlag@ipfire.org> X-BeenThere: network@lists.ipfire.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List for the network package List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: network-bounces@lists.ipfire.org Sender: "network" The following patch adds color support for zone and ports color_cli() Is the cli function to parse the options submitted by a user. color_set() Write a given color into the color config file of a zone or port. color_read() Read a color out of color config file of a zone or port. If this is unsuccessful we use white. color_format_filename() Formats the color config file name. color_hex_is_valid() Check if a color hex is valid. color_hex2rgb() Converts a color hex into rgb values. _find_nearest_rgb_value() Find the nearest value to an rgb value out of: 0; 95; 135; 175; 215; 255; color_rgb2shell() Converts a rgb value triple into an xterm color code. _set_color() Set the shell color which unfourtunately does not work for putty. shell_set_color() Function to set the back and foreground color at once. shell_reset_color() Reset the shell color. Signed-off-by: Jonatan Schlag --- src/functions/functions.colors | 196 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+)