Make read only buffers feel more read only

This commit is contained in:
Conrad Irwin 2024-01-03 13:10:59 -07:00
parent 84171787a5
commit 6877bd4969
4 changed files with 29 additions and 4 deletions

View file

@ -1,7 +1,7 @@
use gpui::Hsla;
use gpui::{hsla, Hsla};
use serde_derive::Deserialize;
use crate::{amber, blue, jade, lime, orange, pink, purple, red};
use crate::{amber, blue, gray, jade, lime, orange, pink, purple, red};
#[derive(Debug, Clone, Copy, Deserialize, Default)]
pub struct PlayerColor {
@ -131,6 +131,15 @@ impl PlayerColors {
*self.0.last().unwrap()
}
pub fn read_only(&self) -> PlayerColor {
let local = self.local();
PlayerColor {
cursor: local.cursor.grayscale(),
background: local.background.grayscale(),
selection: local.selection.grayscale(),
}
}
pub fn color_for_participant(&self, participant_index: u32) -> PlayerColor {
let len = self.0.len() - 1;
self.0[(participant_index as usize % len) + 1]