Show a toast message with the hex color code below the view.
960563
public void showHint() {
    final int[] screenPos = new int[2];
    final Rect displayFrame = new Rect();
    getLocationOnScreen(screenPos);
    getWindowVisibleDisplayFrame(displayFrame);
    final Context context = getContext();
    final int width = getWidth();
    final int height = getHeight();
    final int midy = screenPos[1] + height / 2;
    int referenceX = screenPos[0] + width / 2;
    if (ViewCompat.getLayoutDirection(this) == ViewCompat.LAYOUT_DIRECTION_LTR) {
      final int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
      referenceX = screenWidth - referenceX; // mirror
    }
    StringBuilder hint = new StringBuilder("#");
    if (Color.alpha(color) != 255) {
      hint.append(Integer.toHexString(color).toUpperCase(Locale.ENGLISH));
    } else {
      hint.append(String.format("%06X", 0xFFFFFF & color).toUpperCase(Locale.ENGLISH));
    }
    Toast cheatSheet = Toast.makeText(context, hint.toString(), Toast.LENGTH_SHORT);
    if (midy < displayFrame.height()) {
      // Show along the top; follow action buttons
      cheatSheet.setGravity(Gravity.TOP | GravityCompat.END, referenceX, screenPos[1] + height - displayFrame.top);
    } else {
      // Show along the bottom center
      cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, height);
    }
    cheatSheet.show();
  }
365617
def _color(self, msg, color):
        """"""
        kwargs = {'fg': color}
        return click.style(msg, **kwargs) if self.colorize else msg
481987
def OnBGColor(self, event):
        """"""

        color = event.GetValue().GetRGB()

        post_command_event(self, self.BackgroundColorMsg, color=color)
636001
public void displaySuccess(final String message) {
        notificationMessage.showNotification(SPUIStyleDefinitions.SP_NOTIFICATION_SUCCESS_MESSAGE_STYLE, null, message,
                true);
    }
975024
def show_toast(self, title="Notification", msg="Here comes the message",
                    icon_path=None, duration=5, threaded=False):
        
        if not threaded:
            self._show_toast(title, msg, icon_path, duration)
        else:
            if self.notification_active():
                # We have an active notification, let is finish so we don't spam them
                return False

            self._thread = threading.Thread(target=self._show_toast, args=(title, msg, icon_path, duration))
            self._thread.start()
        return True
246844
def format(message, colour = nil, style = nil)
      c = @map[:colour][colour.to_sym] unless colour.nil?

      if style.nil?
        t = 0
      else
        t = @map[:style][style.to_sym]
      end

      "\e[#{t};#{c}m#{message}\e[0m"
    end
375139
def _show(self, message, indent=0, enable_verbose=True):  # pragma: no cover
        
        if enable_verbose:
            print("    " * indent + message)
1344951
function Toast(beyond) {
        "use strict";
    
        var events = new Events({'bind': this});
    
        var MESSAGE_TYPE = Object.freeze({
            'GENERAL_MESSAGE': 1,
            'GENERAL_ERROR': 2,
            'CONNECTION_ERROR': 3,
            'WARNING': 4
        });
        Object.defineProperty(this, 'MESSAGE_TYPE', {
            'get': function () {
                return MESSAGE_TYPE;
            }
        });
    
        const DURATION_DEFAULT = 3000;
        var messages = new Messages();
    
        var autoincrement = 0;
    
        beyond.showMessage = function (specs, duration) {
    
            // Check parameters
            if (typeof specs === 'string') {
                specs = {
                    'text': specs,
                    'duration': duration
                }
            }
            if (typeof specs !== 'object') {
                throw new Error('Invalid parameters');
            }
            if (!specs.type) {
                specs.type = MESSAGE_TYPE.GENERAL_MESSAGE;
            }
            if (specs.retry && typeof specs.retry !== 'function') {
                throw new Error('Invalid parameters, retry must be a function');
            }
    
            var id = specs.id;
            if (!id) {
                autoincrement++;
                id = 'message-' + autoincrement;
            }
    
            if (specs.type === MESSAGE_TYPE.CONNECTION_ERROR) {
    
                if (!specs.retry) {
                    throw new Error('Invalid parameters, retry was expected');
                }
    
                messages.set({
                    'id': id,
                    'type': MESSAGE_TYPE.CONNECTION_ERROR,
                    'retry': specs.retry,
                    'duration': 0 // Infinity
                });
    
            }
            else if (specs.type === MESSAGE_TYPE.GENERAL_ERROR) {
    
                if (!specs.text) {
                    throw new Error('Invalid parameters, text was expected');
                }
    
                if (specs.retry) {
                    duration = 0; // Infinity
                }
                else if (typeof specs.duration === 'number') {
                    duration = specs.duration;
                }
                else {
                    duration = DURATION_DEFAULT;
                }
    
                messages.set({
                    'id': id,
                    'type': MESSAGE_TYPE.GENERAL_ERROR,
                    'text': specs.text,
                    'retry': specs.retry,
                    'duration': duration
                });
    
            }
            else if (specs.type === MESSAGE_TYPE.GENERAL_MESSAGE) {
    
                if (!specs.text) {
                    throw new Error('Invalid parameters, text was expected');
                }
    
                messages.set({
                    'id': id,
                    'type': MESSAGE_TYPE.GENERAL_MESSAGE,
                    'text': specs.text,
                    'close': !!specs.close,
                    'duration': (typeof specs.duration === 'number') ? specs.duration : DURATION_DEFAULT
                });
    
            }
            else if (specs.type === MESSAGE_TYPE.WARNING) {
    
                if (!specs.text) {
                    throw new Error('Invalid parameters, message was expected');
                }
    
                messages.set({
                    'id': id,
                    'type': MESSAGE_TYPE.WARNING,
                    'text': specs.text,
                    'close': !!specs.close,
                    'duration': (typeof specs.duration === 'number') ? specs.duration : DURATION_DEFAULT
                });
    
            }
            else {
                throw new Error('Invalid parameters, message type is invalid')
            }
    
            events.trigger('change');
            return id;
    
        };
    
        beyond.showConnectionError = function (callback) {
            return beyond.showMessage({
                'type': MESSAGE_TYPE.CONNECTION_ERROR,
                'retry': callback
            });
        };
        beyond.showWarning = function (text, duration) {
            return beyond.showMessage({
                'type': MESSAGE_TYPE.WARNING,
                'text': text,
                'duration': duration
            });
        };
    
        this.removeMessage = function (id) {
            messages.delete(id);
            events.trigger('change');
        };
    
        beyond.removeMessage = this.removeMessage;
    
        this.retry = function () {
    
            var message = this.message;
            if (!message) {
                console.error('Retry method was called, but there is no active message');
                return;
            }
    
            if (message.type === MESSAGE_TYPE.CONNECTION_ERROR) {
    
                var remove = [];
                for (var index in messages.keys) {
    
                    var id = messages.keys[index];
    
                    message = messages.get(id);
                    if (message.type === MESSAGE_TYPE.CONNECTION_ERROR) {
                        message.retry();
                        remove.push(id);
                    }
    
                }
    
                for (var index in remove) {
                    var id = remove[index];
                    messages.delete(id);
                }
    
            }
            else {
    
                if (typeof message.retry !== 'function') {
                    console.error('Message retry function not set');
                }
                else {
                    message.retry();
                }
    
                messages.delete(message);
    
            }
    
            setTimeout(function () {
                events.trigger('change');
            }, 500)
    
    
        };
    
        this.close = function () {
    
            var message = this.message;
            if (!message) {
                return;
            }
    
            if (message.type === MESSAGE_TYPE.CONNECTION_ERROR) {
                console.error('Connection error message type cannot be closed', message);
                return;
            }
    
            messages.delete(message);
            events.trigger('change');
    
        };
    
        Object.defineProperty(this, 'message', {
            'get': function () {
    
                if (messages.typeExists(MESSAGE_TYPE.CONNECTION_ERROR)) {
                    return {
                        'type': MESSAGE_TYPE.CONNECTION_ERROR
                    }
                }
    
                return messages.first;
            }
        });
    
    }
1272847
function message( data , color ) {
	var k , messageString = '' ;

	if ( data.mon ) {
		messageString = '\n' ;

		if ( color ) {
			for ( k in data.mon ) {
				messageString += string.ansi.green + k + string.ansi.reset + ': ' +
					string.ansi.cyan + data.mon[ k ] + string.ansi.reset + '\n' ;
			}
		}
		else {
			for ( k in data.mon ) { messageString += k + ': ' + data.mon[ k ] + '\n' ; }
		}
	}
	else if ( Array.isArray( data.messageData ) && data.isFormat ) {
		//if ( color ) { messageString = string.ansi.italic + string.formatMethod.apply( { color: true } , data.messageData ) ; }
		//else { messageString = string.formatMethod.apply( { color: false } , data.messageData ) ; }

		messageString = string.formatMethod.apply( color ? formatColor : format , data.messageData ) ;
	}
	else if ( data.messageData instanceof Error ) {
		messageString = string.inspectError( { style: color ? 'color' : 'none' } , data.messageData ) ;
	}
	else if ( typeof data.messageData !== 'string' ) {
		messageString = string.inspect( { style: color ? 'color' : 'none' } , data.messageData ) ;
	}
	else {
		// Even if messageData is not an array, it may contains markup, so it should be formated anyway
		//messageString = data.messageData ;
		messageString = string.formatMethod.call( color ? formatColor : format , data.messageData ) ;
	}

	return messageString ;
}
1157243
public Toast setTypeface(Toast toast, String typefaceName, int style) {
		setTypeface((ViewGroup) toast.getView(), typefaceName, style);
		return toast;
	}
1360375
function(ui)
              {
                switch (settings.color.mode)
                {
                  case 'h':
                    var a = ui.val('a');
                    setAlpha.call($this, colorBarL5, Math.precision(((255 - (a || 0)) * 100) / 255, 4));
                    break;
                  case 's':
                    var hva = ui.val('hva'),
                        saturatedColor = new Color({ h: hva && hva.h || 0, s: 100, v: hva != null ? hva.v : 100 });
                    setBG.call($this, colorBarDiv, saturatedColor.val('hex'));
                    setAlpha.call($this, colorBarL2, 100 - (hva != null ? hva.v : 100));
                    setAlpha.call($this, colorBarL5, Math.precision(((255 - (hva && hva.a || 0)) * 100) / 255, 4));
                    break;
                  case 'v':
                    var hsa = ui.val('hsa'),
                        valueColor = new Color({ h: hsa && hsa.h || 0, s: hsa != null ? hsa.s : 100, v: 100 });
                    setBG.call($this, colorBarDiv, valueColor.val('hex'));
                    setAlpha.call($this, colorBarL5, Math.precision(((255 - (hsa && hsa.a || 0)) * 100) / 255, 4));
                    break;
                  case 'r':
                  case 'g':
                  case 'b':
                    var hValue = 0, vValue = 0, rgba = ui.val('rgba');
                    if (settings.color.mode == 'r')
                    {
                      hValue = rgba && rgba.b || 0;
                      vValue = rgba && rgba.g || 0;
                    }
                    else if (settings.color.mode == 'g')
                    {
                      hValue = rgba && rgba.b || 0;
                      vValue = rgba && rgba.r || 0;
                    }
                    else if (settings.color.mode == 'b')
                    {
                      hValue = rgba && rgba.r || 0;
                      vValue = rgba && rgba.g || 0;
                    }
                    var middle = vValue > hValue ? hValue : vValue;
                    setAlpha.call($this, colorBarL2, hValue > vValue ? Math.precision(((hValue - vValue) / (255 - vValue)) * 100, 4) : 0);
                    setAlpha.call($this, colorBarL3, vValue > hValue ? Math.precision(((vValue - hValue) / (255 - hValue)) * 100, 4) : 0);
                    setAlpha.call($this, colorBarL4, Math.precision((middle / 255) * 100, 4));
                    setAlpha.call($this, colorBarL5, Math.precision(((255 - (rgba && rgba.a || 0)) * 100) / 255, 4));
                    break;
                  case 'a':
                    var a = ui.val('a');
                    setBG.call($this, colorBarDiv, ui.val('hex') || '000000');
                    setAlpha.call($this, colorBarL5, a != null ? 0 : 100);
                    setAlpha.call($this, colorBarL6, a != null ? 100 : 0);
                    break;
                }
              }
522187
def _colorize(self, msg, color=None, encode=False):
        
        
        # Valid colors
        colors = {
            'red':    '31',
            'green':  '32',
            'yellow': '33'
        }
        
        # No color specified or unsupported color
        if not color or not color in colors:
            return msg
        
        # The colorized string
        if encode:
            return u'\x1b[1;{}m{}\x1b[0m'.format(colors[color], msg)
        return '\x1b[1;{}m{}\x1b[0m'.format(colors[color], msg)
835199
def _update_color_hsv(self, event=None):
        """"""
        if event is None or event.widget.old_value != event.widget.get():
            h = self.hue.get()
            s = self.saturation.get()
            v = self.value.get()
            sel_color = hsv_to_rgb(h, s, v)
            self.red.set(sel_color[0])
            self.green.set(sel_color[1])
            self.blue.set(sel_color[2])
            if self.alpha_channel:
                sel_color += (self.alpha.get(),)
                self.alphabar.set_color(sel_color)
            hexa = rgb_to_hexa(*sel_color)
            self.hexa.delete(0, "end")
            self.hexa.insert(0, hexa)
            self.square.set_hsv((h, s, v))
            self.bar.set(h)
            self._update_preview()
28993
private void toast(@StringRes int message) {
        if (mCrouton != null) {
            mCrouton.cancel();
            mCrouton = null;
        }
        mCroutonView = new CroutonView(this, getString(message));

        mCrouton = Crouton.make(this, mCroutonView, R.id.activity_artist_main_container);
        mCrouton.show();
    }
295997
private void showToast(@Nullable final String text) {
        if (toast != null) {
            toast.cancel();
        }

        toast = Toast.makeText(getActivity(), text, Toast.LENGTH_SHORT);
        toast.show();
    }
153503
def message(self, text):
        """"""
        line = 0
        # Iterate through each character.
        for char in text:
            # Advance to next line if character is a new line.
            if char == '\n':
                line += 1
                # Move to left or right side depending on text direction.
                col = 0 if self.displaymode & LCD_ENTRYLEFT > 0 else self._cols-1
                self.set_cursor(col, line)
            # Write the character to the display.
            else:
                self.write8(ord(char), True)
609119
function ( color, errorMsg ) {
            color = this.KEYWORDS[color.toLowerCase()];
            if ( color ) {
                return color;
            } else {
                if ( errorMsg ) warning( errorMsg );
                return undefined;
            }
        }