Skip to content

Commit 88bbbeb

Browse files
committed
play with the colors a little
1 parent 4d4fa6c commit 88bbbeb

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55
keywords = ["vulkan", "neofetch", "gpu", "fetch"]
66
license = "AGPL-3.0"
77
repository = "https://github.com/float3/vkfetch-rs"
8-
version = "0.0.6"
8+
version = "0.0.7"
99
name = "vkfetch-rs"
1010
categories = ["command-line-utilities"]
1111
readme = "README.md"

src/lib.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pub mod ascii_art;
33
pub mod device;
44
pub mod vendor;
55

6+
use ascii_art::RED;
67
use ash::*;
78
use device::PhysicalDevice;
89
use std::str;
@@ -20,7 +21,7 @@ pub fn fetch_device(instance: &Instance, device: vk::PhysicalDevice) {
2021

2122
let device = PhysicalDevice::new(instance, device);
2223

23-
let info = get_device_info(device);
24+
let info = get_device_info(device, vendor.get_styles()[0]);
2425

2526
let empty = "".to_string();
2627
for i in 0..art.len().max(info.len()) {
@@ -36,7 +37,7 @@ const BOLD: &str = "\x1B[1m";
3637
const RESET: &str = "\x1B[0m";
3738
const ALIGNMENT: &str = " ";
3839

39-
fn get_device_info(device: PhysicalDevice) -> Vec<String> {
40+
fn get_device_info(device: PhysicalDevice, color: &str) -> Vec<String> {
4041
let mut output: Vec<String> = Vec::new();
4142

4243
output.push(format!(
@@ -47,20 +48,27 @@ fn get_device_info(device: PhysicalDevice) -> Vec<String> {
4748
device.device_type.name()
4849
));
4950

51+
output.push(format!("{}========================================", color));
52+
5053
output.push(format!(
51-
"{}Device: 0x{:X} : 0x{:X} ({})",
54+
"{}{}Device: {}0x{:X} : 0x{:X} ({})",
5255
ALIGNMENT,
56+
color,
57+
RESET,
5358
device.device_id,
5459
device.vendor_id,
5560
device.vendor.name(),
5661
));
5762

5863
output.push(format!(
59-
"{}Driver: {} : {}",
60-
ALIGNMENT, device.driver_name, device.driver_info
64+
"{}{}Driver: {}{} : {}",
65+
ALIGNMENT, color, RESET, device.driver_name, device.driver_info
6166
));
6267

63-
output.push(format!("{}API: {}", ALIGNMENT, device.api_version,));
68+
output.push(format!(
69+
"{}{}API: {}{}",
70+
ALIGNMENT, color, RESET, device.api_version,
71+
));
6472

6573
output
6674
}

0 commit comments

Comments
 (0)